1st release (without comment)

RMS_UART.h

Committer:
nsrwsurasak
Date:
2016-09-15
Revision:
2:38567b4310a4
Parent:
1:5e6c5fbd48d6
Child:
3:ff36fb2cefb0

File content as of revision 2:38567b4310a4:

/**
  ******************************************************************************
  * @file    RMS_UART.cpp
  * @author  Surasak N
  * @version V1
  * @date    15/09/2016
  * @brief   Command for Mini-RMS <> RMS via UART
  ******************************************************************************/
  
#ifndef RMS_UART_H
#define RMS_UART_H

#define EXT_SERIAL              1
#define MSG_BUF_SIZE            25
#define MSG2CMD                 2
#define MSG2FILENAME            (MSG_BUF_SIZE - MSG2CMD)
#define CONTENT_BUF_SIZE        1000

#define CMD_END_OF_CONTENT      "*end*"
#define CMD_LISTFILE            "ls"
#define CMD_READFILE            "rd"
#define CMD_WRITEFILE           "ed"
#define CMD_DELETEFILE          "df"
#define CMD_SYS_RESTART         "rs"

#define FOUND_CSV_FILE          ".csv"
#define FOUND_XML_FILE          ".xml"
#define FOUND_LOG_FILE          ".log"

#define BPS_9600                9600

/** 
  * @brief  Command request definition  
  */ 
typedef enum {
    REQ_NONE,                   /** None Type    : UART do nothing */
    REQ_LISTDIR,                /** Connect Type : List files as in directory */
    REQ_READ,                   /** Read Type    : Read file as file name */
    REQ_WRITE,                  /** Write Type   : Create/Write as file name and contens */
    REQ_DELETE                  /** Delete Type  : Delete file as file name */
} FileRequest_CMD_Type;

/* ###############  Declare functions extern ################## */
extern Serial serial_device;
extern FileRequest_CMD_Type reqFileCmdType;
extern char FileName[MSG2FILENAME];
extern char Content_RxBuf[CONTENT_BUF_SIZE + 1];
extern bool MsgContentManagement;

/* ###############  Function Prototype  ################## */
/** 
  * @note  The detail as RMS_UART.cpp  
  */ 
void Init_SerialDevice();              
void RxMsgInterruptCallback();
void DoTheMsgCmd();
void DoTheContent();
void GetListFileCmd();
void CheckReadEditCmd();
void GetFileName();
void SendContentToFile();
void GetCmdError();
void ClearCmdIndexAndBuf();
void ClearContentIndexAndBuf();
void CheckContentMsg();
void ClearFileNameBuf();
void CheckCmdType();
void ClearFileNameBuf();

#endif /* End of RMS_UART_H */