ban4jp - / SNICInterface_PullReq

Dependents:   SNIC-httpclient-example SNIC-ntpclient-example

Fork of SNICInterface by muRata

Committer:
kishino
Date:
Wed Mar 19 01:48:37 2014 +0000
Revision:
11:c49007d49e52
Parent:
SNICwifi/SNICwifiUartCommand.h@8:50d2509479cd
C_SNICwifi  was modified to singleton class.

Who changed what in which revision?

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