SNIC UART Interface library: Serial to Wi-Fi library for Murata TypeYD Wi-Fi module. For more information about TypeYD: http://www.murata.co.jp/products/microwave/module/lbwb1zzydz/index.html

Dependents:   SNIC-xively-jumpstart-demo SNIC-FluentLogger-example TCPEchoServer murataDemo ... more

Fork of YDwifiInterface by Takao Kishino

Committer:
kishino
Date:
Tue Mar 11 10:38:36 2014 +0000
Revision:
2:0ba43344c814
Child:
3:9f90024d7fb2
Created the basic composition of SNIC UART command API.; Created the UART command for getting firmware's version.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
kishino 2:0ba43344c814 1 #ifndef _YD_WIFI_UART_COMMAND_H_
kishino 2:0ba43344c814 2 #define _YD_WIFI_UART_COMMAND_H_
kishino 2:0ba43344c814 3 #include "mbed.h"
kishino 2:0ba43344c814 4 #include "rtos.h"
kishino 2:0ba43344c814 5
kishino 2:0ba43344c814 6 namespace murata_wifi
kishino 2:0ba43344c814 7 {
kishino 2:0ba43344c814 8
kishino 2:0ba43344c814 9 /** Wait signal ID of UART command */
kishino 2:0ba43344c814 10 #define UART_COMMAND_SIGNAL 0x00000001
kishino 2:0ba43344c814 11 /** Timeout of UART command wait(ms)*/
kishino 2:0ba43344c814 12 #define UART_COMMAND_WAIT_TIMEOUT 10000
kishino 2:0ba43344c814 13
kishino 2:0ba43344c814 14 class C_YDwifiUartCommand
kishino 2:0ba43344c814 15 {
kishino 2:0ba43344c814 16 public:
kishino 2:0ba43344c814 17
kishino 2:0ba43344c814 18 /** Set Command ID
kishino 2:0ba43344c814 19 @param cmd_id Command ID
kishino 2:0ba43344c814 20 */
kishino 2:0ba43344c814 21 void setCommandID( unsigned char cmd_id );
kishino 2:0ba43344c814 22
kishino 2:0ba43344c814 23 /** Get Command ID
kishino 2:0ba43344c814 24 @return Command ID
kishino 2:0ba43344c814 25 */
kishino 2:0ba43344c814 26 unsigned char getCommandID();
kishino 2:0ba43344c814 27
kishino 2:0ba43344c814 28 /** Set Command SubID
kishino 2:0ba43344c814 29 @param cmd_sid Command Sub ID
kishino 2:0ba43344c814 30 */
kishino 2:0ba43344c814 31 void setCommandSID( unsigned char cmd_sid );
kishino 2:0ba43344c814 32
kishino 2:0ba43344c814 33 /** Get Command SubID
kishino 2:0ba43344c814 34 @return Command Sub ID
kishino 2:0ba43344c814 35 */
kishino 2:0ba43344c814 36 unsigned char getCommandSID();
kishino 2:0ba43344c814 37
kishino 2:0ba43344c814 38 /** Set Command status
kishino 2:0ba43344c814 39 @param status Command status
kishino 2:0ba43344c814 40 */
kishino 2:0ba43344c814 41 void setCommandStatus( unsigned char status );
kishino 2:0ba43344c814 42
kishino 2:0ba43344c814 43 /** Get Command status
kishino 2:0ba43344c814 44 @return Command status
kishino 2:0ba43344c814 45 */
kishino 2:0ba43344c814 46 unsigned char getCommandStatus();
kishino 2:0ba43344c814 47
kishino 2:0ba43344c814 48 /** Set Response buffer
kishino 2:0ba43344c814 49 @param buf_p Pointer of response buffer
kishino 2:0ba43344c814 50 */
kishino 2:0ba43344c814 51 void setResponseBuf( unsigned char *buf_p );
kishino 2:0ba43344c814 52
kishino 2:0ba43344c814 53 /** Get Response buffer
kishino 2:0ba43344c814 54 @return Pointer of response buffer
kishino 2:0ba43344c814 55 */
kishino 2:0ba43344c814 56 unsigned char *getResponseBuf();
kishino 2:0ba43344c814 57
kishino 2:0ba43344c814 58 /** Checks in the command which is waiting from Command ID and Sub ID.
kishino 2:0ba43344c814 59 @param command_id Command ID
kishino 2:0ba43344c814 60 @param payload_p Command payload
kishino 2:0ba43344c814 61 @return true: Waiting command / false: Not waiting command
kishino 2:0ba43344c814 62 */
kishino 2:0ba43344c814 63 bool isWaitingCommand( unsigned int command_id, unsigned char *payload_p );
kishino 2:0ba43344c814 64
kishino 2:0ba43344c814 65 int wait();
kishino 2:0ba43344c814 66
kishino 2:0ba43344c814 67 int signal();
kishino 2:0ba43344c814 68
kishino 2:0ba43344c814 69 protected:
kishino 2:0ba43344c814 70 /** Command request thread ID */
kishino 2:0ba43344c814 71 osThreadId mCommandThreadID;
kishino 2:0ba43344c814 72 /** Command ID */
kishino 2:0ba43344c814 73 unsigned char mCommandID;
kishino 2:0ba43344c814 74 /** Command SubID */
kishino 2:0ba43344c814 75 unsigned char mCommandSID;
kishino 2:0ba43344c814 76 /** Status of command response */
kishino 2:0ba43344c814 77 unsigned char mCommandStatus;
kishino 2:0ba43344c814 78 /** ResponseData of command response */
kishino 2:0ba43344c814 79 unsigned char *mResponseBuf_p;
kishino 2:0ba43344c814 80 };
kishino 2:0ba43344c814 81
kishino 2:0ba43344c814 82 }
kishino 2:0ba43344c814 83 #endif