1st release (without comment)

Committer:
nsrwsurasak
Date:
Mon Sep 26 08:26:13 2016 +0000
Revision:
12:3bbbabca6590
Parent:
11:2e1543c03b22
Change error type refer requirement.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
nsrwsurasak 1:5e6c5fbd48d6 1 /**
nsrwsurasak 1:5e6c5fbd48d6 2 ******************************************************************************
nsrwsurasak 1:5e6c5fbd48d6 3 * @file RMS_UART.cpp
nsrwsurasak 1:5e6c5fbd48d6 4 * @author Surasak N
nsrwsurasak 9:025a189e5082 5 * @version V2
nsrwsurasak 9:025a189e5082 6 * @date 20/09/2016
nsrwsurasak 1:5e6c5fbd48d6 7 * @brief Command for Mini-RMS <> RMS via UART
nsrwsurasak 1:5e6c5fbd48d6 8 ******************************************************************************/
nsrwsurasak 1:5e6c5fbd48d6 9
nsrwsurasak 0:bc10ea82aec3 10 #ifndef RMS_UART_H
nsrwsurasak 0:bc10ea82aec3 11 #define RMS_UART_H
nsrwsurasak 0:bc10ea82aec3 12
nsrwsurasak 0:bc10ea82aec3 13 #define EXT_SERIAL 1
nsrwsurasak 0:bc10ea82aec3 14 #define MSG_BUF_SIZE 25
nsrwsurasak 0:bc10ea82aec3 15 #define MSG2CMD 2
nsrwsurasak 0:bc10ea82aec3 16 #define MSG2FILENAME (MSG_BUF_SIZE - MSG2CMD)
nsrwsurasak 11:2e1543c03b22 17 #define CONTENT_BUF_SIZE 1536
nsrwsurasak 1:5e6c5fbd48d6 18
nsrwsurasak 1:5e6c5fbd48d6 19 #define CMD_END_OF_CONTENT "*end*"
nsrwsurasak 1:5e6c5fbd48d6 20 #define CMD_LISTFILE "ls"
nsrwsurasak 1:5e6c5fbd48d6 21 #define CMD_READFILE "rd"
nsrwsurasak 1:5e6c5fbd48d6 22 #define CMD_WRITEFILE "ed"
nsrwsurasak 1:5e6c5fbd48d6 23 #define CMD_DELETEFILE "df"
nsrwsurasak 1:5e6c5fbd48d6 24 #define CMD_SYS_RESTART "rs"
nsrwsurasak 9:025a189e5082 25 #define CMD_SYS_PAUSE "sp"
nsrwsurasak 4:cd5fb2575b50 26 #define CMD_HELP "-h"
nsrwsurasak 1:5e6c5fbd48d6 27
nsrwsurasak 1:5e6c5fbd48d6 28 #define FOUND_CSV_FILE ".csv"
nsrwsurasak 1:5e6c5fbd48d6 29 #define FOUND_XML_FILE ".xml"
nsrwsurasak 1:5e6c5fbd48d6 30 #define FOUND_LOG_FILE ".log"
nsrwsurasak 0:bc10ea82aec3 31
nsrwsurasak 10:ec0470d18ea4 32 #define _SPACE '\0'
nsrwsurasak 9:025a189e5082 33 #define FLAG_STATUS_OK "OK"
nsrwsurasak 9:025a189e5082 34 #define FLAG_STATUS_ERROR "ER"
nsrwsurasak 9:025a189e5082 35 #define FLAG_STATUS_END "*END*"
nsrwsurasak 9:025a189e5082 36
nsrwsurasak 9:025a189e5082 37
nsrwsurasak 9:025a189e5082 38 #define RMS_STATUS_LIST_OK "LK"
nsrwsurasak 9:025a189e5082 39 #define RMS_STATUS_READ_OK "RK"
nsrwsurasak 9:025a189e5082 40
nsrwsurasak 12:3bbbabca6590 41 #define EC_CMD_ERROR "E1"
nsrwsurasak 12:3bbbabca6590 42 #define EC_FILE_NOT_FOUND "E2"
nsrwsurasak 12:3bbbabca6590 43 #define EC_WRITE_ERROR "E3"
nsrwsurasak 12:3bbbabca6590 44 #define EC_FILE_TOO_LARGE "E4"
nsrwsurasak 12:3bbbabca6590 45
nsrwsurasak 0:bc10ea82aec3 46 #define BPS_9600 9600
nsrwsurasak 1:5e6c5fbd48d6 47
nsrwsurasak 1:5e6c5fbd48d6 48 /**
nsrwsurasak 1:5e6c5fbd48d6 49 * @brief Command request definition
nsrwsurasak 1:5e6c5fbd48d6 50 */
nsrwsurasak 1:5e6c5fbd48d6 51 typedef enum {
nsrwsurasak 1:5e6c5fbd48d6 52 REQ_NONE, /** None Type : UART do nothing */
nsrwsurasak 1:5e6c5fbd48d6 53 REQ_LISTDIR, /** Connect Type : List files as in directory */
nsrwsurasak 1:5e6c5fbd48d6 54 REQ_READ, /** Read Type : Read file as file name */
nsrwsurasak 1:5e6c5fbd48d6 55 REQ_WRITE, /** Write Type : Create/Write as file name and contens */
nsrwsurasak 9:025a189e5082 56 REQ_DELETE, /** Delete Type : Delete file as file name */
nsrwsurasak 9:025a189e5082 57 REQ_FLAG_OK, /** Flag OK Type " Send "OK" flag via UART */
nsrwsurasak 9:025a189e5082 58 REQ_READ_CHECK /** Read Check Type : Check available file as in SD card */
nsrwsurasak 1:5e6c5fbd48d6 59 } FileRequest_CMD_Type;
nsrwsurasak 0:bc10ea82aec3 60
nsrwsurasak 1:5e6c5fbd48d6 61 /* ############### Declare functions extern ################## */
nsrwsurasak 1:5e6c5fbd48d6 62 extern Serial serial_device;
nsrwsurasak 1:5e6c5fbd48d6 63 extern FileRequest_CMD_Type reqFileCmdType;
nsrwsurasak 1:5e6c5fbd48d6 64 extern char FileName[MSG2FILENAME];
nsrwsurasak 1:5e6c5fbd48d6 65 extern char Content_RxBuf[CONTENT_BUF_SIZE + 1];
nsrwsurasak 2:38567b4310a4 66 extern bool MsgContentManagement;
nsrwsurasak 1:5e6c5fbd48d6 67
nsrwsurasak 1:5e6c5fbd48d6 68 /* ############### Function Prototype ################## */
nsrwsurasak 1:5e6c5fbd48d6 69 /**
nsrwsurasak 1:5e6c5fbd48d6 70 * @note The detail as RMS_UART.cpp
nsrwsurasak 1:5e6c5fbd48d6 71 */
nsrwsurasak 1:5e6c5fbd48d6 72 void Init_SerialDevice();
nsrwsurasak 0:bc10ea82aec3 73 void RxMsgInterruptCallback();
nsrwsurasak 0:bc10ea82aec3 74 void DoTheMsgCmd();
nsrwsurasak 0:bc10ea82aec3 75 void DoTheContent();
nsrwsurasak 0:bc10ea82aec3 76 void GetListFileCmd();
nsrwsurasak 0:bc10ea82aec3 77 void CheckReadEditCmd();
nsrwsurasak 0:bc10ea82aec3 78 void GetFileName();
nsrwsurasak 0:bc10ea82aec3 79 void SendContentToFile();
nsrwsurasak 0:bc10ea82aec3 80 void GetCmdError();
nsrwsurasak 0:bc10ea82aec3 81 void ClearCmdIndexAndBuf();
nsrwsurasak 0:bc10ea82aec3 82 void ClearContentIndexAndBuf();
nsrwsurasak 1:5e6c5fbd48d6 83 void CheckContentMsg();
nsrwsurasak 2:38567b4310a4 84 void ClearFileNameBuf();
nsrwsurasak 1:5e6c5fbd48d6 85 void CheckCmdType();
nsrwsurasak 1:5e6c5fbd48d6 86 void ClearFileNameBuf();
nsrwsurasak 4:cd5fb2575b50 87 void GetHelpCmd();
nsrwsurasak 0:bc10ea82aec3 88
nsrwsurasak 1:5e6c5fbd48d6 89 #endif /* End of RMS_UART_H */