-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcmdstream.cpp
More file actions
61 lines (53 loc) · 697 Bytes
/
Copy pathcmdstream.cpp
File metadata and controls
61 lines (53 loc) · 697 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#include "cmdstream.h"
namespace Cmd
{
//
//
Stream::Stream() :
m_index( 0 ),
m_isCmdReady( false )
{
m_lastCmd[ 0 ] = '\0';
}
//
//
bool Stream::write( const uint8_t *data, size_t size )
{
return true;
}
//
//
void Stream::printf( const char *format, ... )
{
}
//
//
void Stream::print( const char *string )
{
}
//
//
void Stream::println( const char *string )
{
}
//
//
void Stream::addChar( char value )
{
if( '\n' == value )
return;
if( 0 == m_index )
m_isCmdReady = false;
if( '\r' == value )
{
m_lastCmd[ m_index ] = '\0';
m_index = 0;
m_isCmdReady = true;
}
else if( m_index < ( COMMAND_STREAM_SIZE - 1 ) )
{
m_lastCmd[ m_index ] = value;
m_index ++;
}
}
}