debug version

Dependents:   HTTPClient_WiFi_HelloWorld_src

Fork of SNICInterface by muRata

Committer:
kishino
Date:
Tue Mar 25 01:42:25 2014 +0000
Revision:
12:0254eaccfda2
Child:
14:54378c96d285
Refactoring of the class name

Who changed what in which revision?

UserRevisionLine numberNew contents of line
kishino 12:0254eaccfda2 1 #ifndef _SNIC_UART_COMMAND_MANAGER_H_
kishino 12:0254eaccfda2 2 #define _SNIC_UART_COMMAND_MANAGER_H_
kishino 12:0254eaccfda2 3 #include "mbed.h"
kishino 12:0254eaccfda2 4 #include "rtos.h"
kishino 12:0254eaccfda2 5
kishino 12:0254eaccfda2 6 namespace murata_wifi
kishino 12:0254eaccfda2 7 {
kishino 12:0254eaccfda2 8 /** Max length of SSID */
kishino 12:0254eaccfda2 9 #define SSID_MAX_LENGTH 32
kishino 12:0254eaccfda2 10 /** Max length of BSSID */
kishino 12:0254eaccfda2 11 #define BSSID_MAC_LENTH 6
kishino 12:0254eaccfda2 12 /** Length of Country code */
kishino 12:0254eaccfda2 13 #define COUNTRYC_CODE_LENTH 2
kishino 12:0254eaccfda2 14
kishino 12:0254eaccfda2 15 /** Wait signal ID of UART command */
kishino 12:0254eaccfda2 16 #define UART_COMMAND_SIGNAL 0x00000001
kishino 12:0254eaccfda2 17 /** Timeout of UART command wait(ms)*/
kishino 12:0254eaccfda2 18 #define UART_COMMAND_WAIT_TIMEOUT 10000
kishino 12:0254eaccfda2 19
kishino 12:0254eaccfda2 20 /** Scan result
kishino 12:0254eaccfda2 21 */
kishino 12:0254eaccfda2 22 typedef struct {
kishino 12:0254eaccfda2 23 bool is_complete;
kishino 12:0254eaccfda2 24 /** Channel */
kishino 12:0254eaccfda2 25 unsigned char channel;
kishino 12:0254eaccfda2 26 /** RSSI */
kishino 12:0254eaccfda2 27 signed char rssi;
kishino 12:0254eaccfda2 28 /** Security type */
kishino 12:0254eaccfda2 29 unsigned char security;
kishino 12:0254eaccfda2 30 /** BSSID */
kishino 12:0254eaccfda2 31 unsigned char bssid[BSSID_MAC_LENTH];
kishino 12:0254eaccfda2 32 /** Network type */
kishino 12:0254eaccfda2 33 unsigned char network_type;
kishino 12:0254eaccfda2 34 /** Max data rate */
kishino 12:0254eaccfda2 35 unsigned char max_rate;
kishino 12:0254eaccfda2 36 /** SSID */
kishino 12:0254eaccfda2 37 char ssid[SSID_MAX_LENGTH+1];
kishino 12:0254eaccfda2 38 }tagSCAN_RESULT_T;
kishino 12:0254eaccfda2 39
kishino 12:0254eaccfda2 40 /** C_SNIC_UartCommandManager class
kishino 12:0254eaccfda2 41 */
kishino 12:0254eaccfda2 42 class C_SNIC_UartCommandManager
kishino 12:0254eaccfda2 43 {
kishino 12:0254eaccfda2 44 public:
kishino 12:0254eaccfda2 45 /** Set Command ID
kishino 12:0254eaccfda2 46 @param cmd_id Command ID
kishino 12:0254eaccfda2 47 */
kishino 12:0254eaccfda2 48 void setCommandID( unsigned char cmd_id );
kishino 12:0254eaccfda2 49
kishino 12:0254eaccfda2 50 /** Get Command ID
kishino 12:0254eaccfda2 51 @return Command ID
kishino 12:0254eaccfda2 52 */
kishino 12:0254eaccfda2 53 unsigned char getCommandID();
kishino 12:0254eaccfda2 54
kishino 12:0254eaccfda2 55 /** Set Command SubID
kishino 12:0254eaccfda2 56 @param cmd_sid Command Sub ID
kishino 12:0254eaccfda2 57 */
kishino 12:0254eaccfda2 58 void setCommandSID( unsigned char cmd_sid );
kishino 12:0254eaccfda2 59
kishino 12:0254eaccfda2 60 /** Get Command SubID
kishino 12:0254eaccfda2 61 @return Command Sub ID
kishino 12:0254eaccfda2 62 */
kishino 12:0254eaccfda2 63 unsigned char getCommandSID();
kishino 12:0254eaccfda2 64
kishino 12:0254eaccfda2 65 /** Set Command status
kishino 12:0254eaccfda2 66 @param status Command status
kishino 12:0254eaccfda2 67 */
kishino 12:0254eaccfda2 68 void setCommandStatus( unsigned char status );
kishino 12:0254eaccfda2 69
kishino 12:0254eaccfda2 70 /** Get Command status
kishino 12:0254eaccfda2 71 @return Command status
kishino 12:0254eaccfda2 72 */
kishino 12:0254eaccfda2 73 unsigned char getCommandStatus();
kishino 12:0254eaccfda2 74
kishino 12:0254eaccfda2 75 /** Set Response buffer
kishino 12:0254eaccfda2 76 @param buf_p Pointer of response buffer
kishino 12:0254eaccfda2 77 */
kishino 12:0254eaccfda2 78 void setResponseBuf( unsigned char *buf_p );
kishino 12:0254eaccfda2 79
kishino 12:0254eaccfda2 80 /** Get Response buffer
kishino 12:0254eaccfda2 81 @return Pointer of response buffer
kishino 12:0254eaccfda2 82 */
kishino 12:0254eaccfda2 83 unsigned char *getResponseBuf();
kishino 12:0254eaccfda2 84
kishino 12:0254eaccfda2 85 /** Set scan result callback hander
kishino 12:0254eaccfda2 86 @param handler_p Pointer of callback function
kishino 12:0254eaccfda2 87 */
kishino 12:0254eaccfda2 88 void setScanResultHandler( void (*handler_p)(tagSCAN_RESULT_T *scan_result) );
kishino 12:0254eaccfda2 89
kishino 12:0254eaccfda2 90 void bufferredPacket( unsigned char *payload_p, int payload_len );
kishino 12:0254eaccfda2 91
kishino 12:0254eaccfda2 92 void scanResultIndicate( unsigned char *payload_p, int payload_len );
kishino 12:0254eaccfda2 93
kishino 12:0254eaccfda2 94 /** Checks in the command which is waiting from Command ID and Sub ID.
kishino 12:0254eaccfda2 95 @param command_id Command ID
kishino 12:0254eaccfda2 96 @param payload_p Command payload
kishino 12:0254eaccfda2 97 @return true: Waiting command / false: Not waiting command
kishino 12:0254eaccfda2 98 */
kishino 12:0254eaccfda2 99 bool isWaitingCommand( unsigned int command_id, unsigned char *payload_p );
kishino 12:0254eaccfda2 100
kishino 12:0254eaccfda2 101 int wait();
kishino 12:0254eaccfda2 102
kishino 12:0254eaccfda2 103 int signal();
kishino 12:0254eaccfda2 104
kishino 12:0254eaccfda2 105 private:
kishino 12:0254eaccfda2 106 /** Command request thread ID */
kishino 12:0254eaccfda2 107 osThreadId mCommandThreadID;
kishino 12:0254eaccfda2 108 /** Command ID */
kishino 12:0254eaccfda2 109 unsigned char mCommandID;
kishino 12:0254eaccfda2 110 /** Command SubID */
kishino 12:0254eaccfda2 111 unsigned char mCommandSID;
kishino 12:0254eaccfda2 112 /** Status of command response */
kishino 12:0254eaccfda2 113 unsigned char mCommandStatus;
kishino 12:0254eaccfda2 114 /** ResponseData of command response */
kishino 12:0254eaccfda2 115 unsigned char *mResponseBuf_p;
kishino 12:0254eaccfda2 116 /** Scan result handler */
kishino 12:0254eaccfda2 117 void (*mScanResultHandler_p)(tagSCAN_RESULT_T *scan_result);
kishino 12:0254eaccfda2 118 };
kishino 12:0254eaccfda2 119
kishino 12:0254eaccfda2 120 }
kishino 12:0254eaccfda2 121 #endif