gccDppConsole Test C++ SDK  20170920
DPP C++ Console Demonstration
DeviceIO/AsciiCmdUtilities.h
Go to the documentation of this file.
00001 #pragma once
00002 #include <stdlib.h>
00003 #include <stdio.h>
00004 #include <math.h>
00005 #include <string>
00006 #include <cctype> // std::toupper, std::tolower
00007 using namespace std; 
00008 #include "stringex.h"
00009 #include "DppConst.h"
00010 
00011 #ifndef LINE_MAX
00012         #define LINE_MAX 256
00013 #endif
00014 #define DP4_PX4_OLD_CFG_SIZE 64
00015 #define DP5_MAX_CFG_SIZE 512            /// 512 + 8 Bytes (2 SYNC,2 PID,2 LEN,2 CHKSUM)
00016 #define Whitespace "\t\n\v\f\r\0x20"    /// $ = Chr$(0) + Chr$(9) + Chr$(10) + Chr$(11) + Chr$(12) + Chr$(13) + Chr$(32)
00017 
00018 class CAsciiCmdUtilities
00019 {
00020 public:
00021         CAsciiCmdUtilities(void);
00022         ~CAsciiCmdUtilities(void);
00024         std::string MakeUpper(std::string myString);
00026         std::string RemWhitespace(std::string strLine);
00028         std::string GetDP5CfgStr(std::string strFilename);
00030         std::string GetDP5ScaStr(std::string strFilename);
00031         std::string CreateResTestReadBackCmd(bool bSendCoarseFineGain, int DppType);
00033         std::string CreateFullReadBackCmd(bool PC5_PRESENT, int DppType, bool isDP5_RevDxGains, unsigned char DPP_ECO);
00035         std::string CreateFullReadBackCmdMCA8000D(int DppType);
00037         std::string RemoveCmd(std::string strCmd, std::string strCfgData);
00039         std::string RemoveCmdByDeviceType(std::string strCfgDataIn, bool PC5_PRESENT, int DppType, bool isDP5_RevDxGains, unsigned char DPP_ECO);
00041         std::string RemoveCmdByDeviceTypeDP5DxK(std::string strCfgDataIn, bool PC5_PRESENT, int DppType);
00043         std::string Remove_MCA8000D_Cmds(std::string strCfgDataIn, int DppType);
00044         // replaces all occurrences of substring in string
00045         std::string ReplaceCmdText(std::string strInTextIn, std::string strFrom, std::string strTo);
00046         // breaks ASCII Command string into two chuncks, returns split position
00047         int GetCmdChunk(std::string strCmd);
00049         bool CopyAsciiData(unsigned char Data[], string strCfg, long lLen);
00050 };