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

YDwifi/YDwifiUartCommand.h

Committer:
kishino
Date:
2014-03-11
Revision:
2:0ba43344c814
Child:
3:9f90024d7fb2

File content as of revision 2:0ba43344c814:

#ifndef _YD_WIFI_UART_COMMAND_H_
#define _YD_WIFI_UART_COMMAND_H_
#include "mbed.h"
#include "rtos.h"

namespace murata_wifi
{
    
/** Wait signal ID of UART command */
#define UART_COMMAND_SIGNAL        0x00000001
/** Timeout of UART command wait(ms)*/
#define UART_COMMAND_WAIT_TIMEOUT  10000

class C_YDwifiUartCommand
{
public:

    /** Set Command ID
        @param cmd_id Command ID
    */
    void setCommandID( unsigned char cmd_id );

    /** Get Command ID
        @return Command ID
    */
    unsigned char getCommandID();

    /** Set Command SubID
        @param cmd_sid Command Sub ID
    */
    void setCommandSID( unsigned char cmd_sid );

    /** Get Command SubID
        @return Command Sub ID
    */
    unsigned char getCommandSID();
    
    /** Set Command status
        @param status Command status
    */
    void setCommandStatus( unsigned char status );

    /** Get Command status
        @return Command status
    */
    unsigned char getCommandStatus();

    /** Set Response buffer
        @param buf_p Pointer of response buffer
    */
    void setResponseBuf( unsigned char *buf_p );

    /** Get Response buffer
        @return Pointer of response buffer
    */
    unsigned char *getResponseBuf();
    
    /** Checks in the command which is waiting from Command ID and Sub ID.
        @param  command_id  Command ID
        @param  payload_p   Command payload
        @return true: Waiting command / false: Not waiting command
    */
    bool isWaitingCommand( unsigned int command_id, unsigned char *payload_p );

    int wait();
    
    int signal();

protected:
    /** Command request thread ID */
    osThreadId    mCommandThreadID;
    /** Command ID */
    unsigned char mCommandID;
    /** Command SubID */
    unsigned char mCommandSID;
    /** Status of command response */
    unsigned char mCommandStatus;
    /** ResponseData of command response */
    unsigned char *mResponseBuf_p;
};
    
}
#endif