Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: LCD_DISCO_F429ZI mbed TS_DISCO_F429ZI BSP_DISCO_F429ZI
command_decoder.h
00001 #ifndef COMMAND_DECODER_H 00002 #define COMMAND_DECODER_H 00003 00004 #define MAX_TOKEN_NR 2 00005 #define MAX_KEYWORD_STRING_LTH 10 00006 #define MAX_KEYWORD_NR 4 00007 00008 00009 enum CharacterType {TOKEN, DELIMITER}; 00010 enum TokenType {KEYWORD, NUMBER, STRING}; 00011 enum KeywordCode { ID, CALIB, GOTO, STEP }; 00012 00013 struct Keyword { 00014 00015 enum KeywordCode eCode; 00016 char cString[MAX_KEYWORD_STRING_LTH + 1]; 00017 }; 00018 00019 00020 union TokenValue { 00021 00022 enum KeywordCode eKeyword; // jezeli KEYWORD 00023 unsigned int uiNumber; // jezeli NUMBER 00024 char * pcString; // jezeli STRING 00025 }; 00026 00027 struct tToken { 00028 00029 enum TokenType eType; // KEYWORD, NUMBER, STRING 00030 union TokenValue uValue; // enum, unsigned int, char* 00031 }; 00032 00033 class Token { 00034 00035 private: 00036 unsigned char ucFindTokensInString (char *pcString); 00037 void DecodeTokens(void); 00038 enum Result eSringToKeyword (char pcStr[],enum KeywordCode *peKeywordCode); 00039 enum Result eHexStringToUInt(char pcStr[],unsigned int *puiValue); 00040 void ReplaceCharactersInString(char pcString[],char cOldChar,char cNewChar); 00041 public: 00042 struct tToken asToken[MAX_TOKEN_NR]; 00043 unsigned char ucTokenNr; 00044 void DecodeMsg(char *pcString); 00045 }; 00046 00047 00048 #endif
Generated on Mon Aug 1 2022 00:15:39 by
