1st release (without comment)

RMS_UART.h

Committer:
nsrwsurasak
Date:
2016-09-16
Revision:
4:cd5fb2575b50
Parent:
3:ff36fb2cefb0
Child:
7:5401cc8ee60f
Child:
8:f08bb4074bc8

File content as of revision 4:cd5fb2575b50:

/**
  ******************************************************************************
  * @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        1500

#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 CMD_HELP                "-h"

#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();
void GetHelpCmd();

#endif /* End of RMS_UART_H */