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
SNICwifiInterface.cpp@9:a98b45e766c8, 2014-03-18 (annotated)
- Committer:
- kishino
- Date:
- Tue Mar 18 01:13:52 2014 +0000
- Revision:
- 9:a98b45e766c8
- Parent:
- 8:50d2509479cd
- Child:
- 10:49ffd373066b
[Refactoring]Updated that function for get buffer from memorypool.
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| kishino | 8:50d2509479cd | 1 | #include "SNICwifiInterface.h" |
| kishino | 8:50d2509479cd | 2 | #include "SNICwifi_uartmsg.h" |
| kishino | 8:50d2509479cd | 3 | |
| kishino | 8:50d2509479cd | 4 | using namespace murata_wifi; |
| kishino | 8:50d2509479cd | 5 | |
| kishino | 8:50d2509479cd | 6 | #define UART_REQUEST_PAYLOAD_MAX 256 |
| kishino | 8:50d2509479cd | 7 | |
| kishino | 8:50d2509479cd | 8 | C_SNICwifiInterface::C_SNICwifiInterface( PinName tx, PinName rx, PinName cts, PinName rts, PinName reset, PinName alarm, int baud): |
| kishino | 8:50d2509479cd | 9 | C_SNICwifi(tx, rx, cts, rts, reset, alarm, baud) |
| kishino | 8:50d2509479cd | 10 | { |
| kishino | 8:50d2509479cd | 11 | } |
| kishino | 8:50d2509479cd | 12 | |
| kishino | 8:50d2509479cd | 13 | int C_SNICwifiInterface::init() |
| kishino | 8:50d2509479cd | 14 | { |
| kishino | 8:50d2509479cd | 15 | /* Initialize UART */ |
| kishino | 8:50d2509479cd | 16 | initUart(); |
| kishino | 8:50d2509479cd | 17 | |
| kishino | 8:50d2509479cd | 18 | /* Initialize SNIC API */ |
| kishino | 9:a98b45e766c8 | 19 | // Get buffer for response payload from MemoryPool |
| kishino | 9:a98b45e766c8 | 20 | tagMEMPOOL_BLOCK_T *payload_buf = getAlocCmdBuf(); |
| kishino | 8:50d2509479cd | 21 | if( payload_buf == NULL ) |
| kishino | 8:50d2509479cd | 22 | { |
| kishino | 8:50d2509479cd | 23 | printf("snic_init payload_buf NULL\r\n"); |
| kishino | 8:50d2509479cd | 24 | return -1; |
| kishino | 8:50d2509479cd | 25 | } |
| kishino | 8:50d2509479cd | 26 | |
| kishino | 8:50d2509479cd | 27 | tagSNIC_INIT_REQ_T req; |
| kishino | 8:50d2509479cd | 28 | // Make request |
| kishino | 8:50d2509479cd | 29 | req.cmd_sid = UART_CMD_SID_SNIC_INIT_REQ; |
| kishino | 8:50d2509479cd | 30 | req.seq = mUartRequestSeq++; |
| kishino | 8:50d2509479cd | 31 | req.buf_size = 0x800; |
| kishino | 8:50d2509479cd | 32 | |
| kishino | 8:50d2509479cd | 33 | unsigned char payload_array[UART_REQUEST_PAYLOAD_MAX]; |
| kishino | 8:50d2509479cd | 34 | unsigned char command_array[UART_REQUEST_PAYLOAD_MAX]; |
| kishino | 8:50d2509479cd | 35 | unsigned short payload_len; |
| kishino | 8:50d2509479cd | 36 | unsigned int command_len; |
| kishino | 8:50d2509479cd | 37 | int ret; |
| kishino | 8:50d2509479cd | 38 | |
| kishino | 8:50d2509479cd | 39 | |
| kishino | 8:50d2509479cd | 40 | // Make command payload |
| kishino | 8:50d2509479cd | 41 | payload_len = C_SNIC_UartMsg::makePayload( sizeof(tagSNIC_INIT_REQ_T), (unsigned char *)&req, payload_array ); |
| kishino | 8:50d2509479cd | 42 | // Make all command request |
| kishino | 8:50d2509479cd | 43 | command_len = C_SNIC_UartMsg::makeRequest( UART_CMD_ID_SNIC, payload_array, payload_len, command_array ); |
| kishino | 8:50d2509479cd | 44 | |
| kishino | 8:50d2509479cd | 45 | // Set data for response |
| kishino | 8:50d2509479cd | 46 | mUartCommand.setCommandID( UART_CMD_ID_SNIC ); |
| kishino | 8:50d2509479cd | 47 | mUartCommand.setCommandSID( req.cmd_sid ); |
| kishino | 8:50d2509479cd | 48 | mUartCommand.setResponseBuf( payload_buf->buf ); |
| kishino | 8:50d2509479cd | 49 | |
| kishino | 8:50d2509479cd | 50 | // Send uart command request |
| kishino | 8:50d2509479cd | 51 | sendUart( command_len, command_array ); |
| kishino | 8:50d2509479cd | 52 | |
| kishino | 8:50d2509479cd | 53 | // Wait UART response |
| kishino | 8:50d2509479cd | 54 | ret = mUartCommand.wait(); |
| kishino | 8:50d2509479cd | 55 | if( ret != 0 ) |
| kishino | 8:50d2509479cd | 56 | { |
| kishino | 8:50d2509479cd | 57 | printf( "snic_init failed\r\n" ); |
| kishino | 9:a98b45e766c8 | 58 | freeCmdBuf( payload_buf ); |
| kishino | 8:50d2509479cd | 59 | return -1; |
| kishino | 8:50d2509479cd | 60 | } |
| kishino | 8:50d2509479cd | 61 | |
| kishino | 8:50d2509479cd | 62 | if( mUartCommand.getCommandStatus() != 0 ) |
| kishino | 8:50d2509479cd | 63 | { |
| kishino | 8:50d2509479cd | 64 | printf("snic_init status:%02x\r\n", mUartCommand.getCommandStatus()); |
| kishino | 8:50d2509479cd | 65 | ret = -1; |
| kishino | 8:50d2509479cd | 66 | } |
| kishino | 9:a98b45e766c8 | 67 | freeCmdBuf( payload_buf ); |
| kishino | 8:50d2509479cd | 68 | |
| kishino | 8:50d2509479cd | 69 | return ret; |
| kishino | 8:50d2509479cd | 70 | } |
| kishino | 8:50d2509479cd | 71 | |
| kishino | 8:50d2509479cd | 72 | int C_SNICwifiInterface::getFWVersion( unsigned char *version_p ) |
| kishino | 8:50d2509479cd | 73 | { |
| kishino | 8:50d2509479cd | 74 | // Get buffer for response payload from MemoryPool |
| kishino | 9:a98b45e766c8 | 75 | tagMEMPOOL_BLOCK_T *payload_buf = getAlocCmdBuf(); |
| kishino | 8:50d2509479cd | 76 | if( payload_buf == NULL ) |
| kishino | 8:50d2509479cd | 77 | { |
| kishino | 8:50d2509479cd | 78 | printf("getFWVersion payload_buf NULL\r\n"); |
| kishino | 8:50d2509479cd | 79 | return -1; |
| kishino | 8:50d2509479cd | 80 | } |
| kishino | 8:50d2509479cd | 81 | |
| kishino | 8:50d2509479cd | 82 | tagGEN_FW_VER_GET_REQ_T req; |
| kishino | 8:50d2509479cd | 83 | // Make request |
| kishino | 8:50d2509479cd | 84 | req.cmd_sid = UART_CMD_SID_GEN_FW_VER_GET_REQ; |
| kishino | 8:50d2509479cd | 85 | req.seq = mUartRequestSeq++; |
| kishino | 8:50d2509479cd | 86 | |
| kishino | 8:50d2509479cd | 87 | unsigned char payload_array[UART_REQUEST_PAYLOAD_MAX]; |
| kishino | 8:50d2509479cd | 88 | unsigned char command_array[UART_REQUEST_PAYLOAD_MAX]; |
| kishino | 8:50d2509479cd | 89 | unsigned short payload_len; |
| kishino | 8:50d2509479cd | 90 | unsigned int command_len; |
| kishino | 8:50d2509479cd | 91 | int ret; |
| kishino | 8:50d2509479cd | 92 | |
| kishino | 8:50d2509479cd | 93 | // Make command payload |
| kishino | 8:50d2509479cd | 94 | payload_len = C_SNIC_UartMsg::makePayload( sizeof(tagGEN_FW_VER_GET_REQ_T), (unsigned char *)&req, payload_array ); |
| kishino | 8:50d2509479cd | 95 | // Make all command request |
| kishino | 8:50d2509479cd | 96 | command_len = C_SNIC_UartMsg::makeRequest( UART_CMD_ID_GEN, payload_array, payload_len, command_array ); |
| kishino | 8:50d2509479cd | 97 | |
| kishino | 8:50d2509479cd | 98 | // Set data for response |
| kishino | 8:50d2509479cd | 99 | mUartCommand.setCommandID( UART_CMD_ID_GEN ); |
| kishino | 8:50d2509479cd | 100 | mUartCommand.setCommandSID( req.cmd_sid ); |
| kishino | 8:50d2509479cd | 101 | mUartCommand.setResponseBuf( payload_buf->buf ); |
| kishino | 8:50d2509479cd | 102 | |
| kishino | 8:50d2509479cd | 103 | // Send uart command request |
| kishino | 8:50d2509479cd | 104 | sendUart( command_len, command_array ); |
| kishino | 8:50d2509479cd | 105 | |
| kishino | 8:50d2509479cd | 106 | // Wait UART response |
| kishino | 8:50d2509479cd | 107 | ret = mUartCommand.wait(); |
| kishino | 8:50d2509479cd | 108 | if( ret != 0 ) |
| kishino | 8:50d2509479cd | 109 | { |
| kishino | 8:50d2509479cd | 110 | printf( "getFWversion failed\r\n" ); |
| kishino | 9:a98b45e766c8 | 111 | freeCmdBuf( payload_buf ); |
| kishino | 8:50d2509479cd | 112 | return -1; |
| kishino | 8:50d2509479cd | 113 | } |
| kishino | 8:50d2509479cd | 114 | |
| kishino | 8:50d2509479cd | 115 | if( mUartCommand.getCommandStatus() == 0 ) |
| kishino | 8:50d2509479cd | 116 | { |
| kishino | 8:50d2509479cd | 117 | unsigned char version_len = payload_buf->buf[3]; |
| kishino | 8:50d2509479cd | 118 | memcpy( version_p, &payload_buf->buf[4], version_len ); |
| kishino | 8:50d2509479cd | 119 | } |
| kishino | 9:a98b45e766c8 | 120 | freeCmdBuf( payload_buf ); |
| kishino | 8:50d2509479cd | 121 | return 0; |
| kishino | 8:50d2509479cd | 122 | } |
| kishino | 8:50d2509479cd | 123 | |
| kishino | 8:50d2509479cd | 124 | int C_SNICwifiInterface::connect(const char *ssid_p, unsigned char ssid_len, E_SECURITY sec_type |
| kishino | 8:50d2509479cd | 125 | , const char *sec_key_p, unsigned char sec_key_len) |
| kishino | 8:50d2509479cd | 126 | { |
| kishino | 8:50d2509479cd | 127 | // Parameter check(SSID) |
| kishino | 8:50d2509479cd | 128 | if( (ssid_p == NULL) || (ssid_len == 0) ) |
| kishino | 8:50d2509479cd | 129 | { |
| kishino | 8:50d2509479cd | 130 | printf( "connect failed [ parameter NG:SSID ]\r\n" ); |
| kishino | 8:50d2509479cd | 131 | return -1; |
| kishino | 8:50d2509479cd | 132 | } |
| kishino | 8:50d2509479cd | 133 | |
| kishino | 8:50d2509479cd | 134 | // Parameter check(Security key) |
| kishino | 8:50d2509479cd | 135 | if( (sec_type != e_SEC_OPEN) && ( (sec_key_len == 0) || (sec_key_p == NULL) ) ) |
| kishino | 8:50d2509479cd | 136 | { |
| kishino | 8:50d2509479cd | 137 | printf( "connect failed [ parameter NG:Security key ]\r\n" ); |
| kishino | 8:50d2509479cd | 138 | return -1; |
| kishino | 8:50d2509479cd | 139 | } |
| kishino | 8:50d2509479cd | 140 | |
| kishino | 9:a98b45e766c8 | 141 | // Get buffer for response payload from MemoryPool |
| kishino | 9:a98b45e766c8 | 142 | tagMEMPOOL_BLOCK_T *payload_buf = getAlocCmdBuf(); |
| kishino | 8:50d2509479cd | 143 | if( payload_buf == NULL ) |
| kishino | 8:50d2509479cd | 144 | { |
| kishino | 8:50d2509479cd | 145 | printf("connect payload_buf NULL\r\n"); |
| kishino | 8:50d2509479cd | 146 | return -1; |
| kishino | 8:50d2509479cd | 147 | } |
| kishino | 8:50d2509479cd | 148 | |
| kishino | 8:50d2509479cd | 149 | unsigned char buf[UART_REQUEST_PAYLOAD_MAX]; |
| kishino | 8:50d2509479cd | 150 | unsigned char payload_array[UART_REQUEST_PAYLOAD_MAX]; |
| kishino | 8:50d2509479cd | 151 | unsigned char command_array[UART_REQUEST_PAYLOAD_MAX]; |
| kishino | 8:50d2509479cd | 152 | unsigned int buf_len = 0; |
| kishino | 8:50d2509479cd | 153 | unsigned short payload_len; |
| kishino | 8:50d2509479cd | 154 | unsigned int command_len; |
| kishino | 8:50d2509479cd | 155 | int ret; |
| kishino | 8:50d2509479cd | 156 | |
| kishino | 8:50d2509479cd | 157 | memset( buf, 0, UART_REQUEST_PAYLOAD_MAX ); |
| kishino | 8:50d2509479cd | 158 | // Make request |
| kishino | 8:50d2509479cd | 159 | buf[0] = UART_CMD_SID_WIFI_JOIN_REQ; |
| kishino | 8:50d2509479cd | 160 | buf_len++; |
| kishino | 8:50d2509479cd | 161 | buf[1] = mUartRequestSeq++; |
| kishino | 8:50d2509479cd | 162 | buf_len++; |
| kishino | 8:50d2509479cd | 163 | // SSID |
| kishino | 8:50d2509479cd | 164 | memcpy( &buf[2], ssid_p, ssid_len ); |
| kishino | 8:50d2509479cd | 165 | buf_len += ssid_len; |
| kishino | 8:50d2509479cd | 166 | buf_len++; |
| kishino | 8:50d2509479cd | 167 | |
| kishino | 8:50d2509479cd | 168 | // Security mode |
| kishino | 8:50d2509479cd | 169 | buf[ buf_len ] = (unsigned char)sec_type; |
| kishino | 8:50d2509479cd | 170 | buf_len++; |
| kishino | 8:50d2509479cd | 171 | |
| kishino | 8:50d2509479cd | 172 | // Security key |
| kishino | 8:50d2509479cd | 173 | if( sec_type != e_SEC_OPEN ) |
| kishino | 8:50d2509479cd | 174 | { |
| kishino | 8:50d2509479cd | 175 | buf[ buf_len ] = sec_key_len; |
| kishino | 8:50d2509479cd | 176 | buf_len++; |
| kishino | 8:50d2509479cd | 177 | if( sec_key_len > 0 ) |
| kishino | 8:50d2509479cd | 178 | { |
| kishino | 8:50d2509479cd | 179 | memcpy( &buf[buf_len], sec_key_p, sec_key_len ); |
| kishino | 8:50d2509479cd | 180 | buf_len += sec_key_len; |
| kishino | 8:50d2509479cd | 181 | } |
| kishino | 8:50d2509479cd | 182 | } |
| kishino | 8:50d2509479cd | 183 | // Make command payload |
| kishino | 8:50d2509479cd | 184 | payload_len = C_SNIC_UartMsg::makePayload( buf_len, (unsigned char *)buf, payload_array ); |
| kishino | 8:50d2509479cd | 185 | // Make all command request |
| kishino | 8:50d2509479cd | 186 | command_len = C_SNIC_UartMsg::makeRequest( UART_CMD_ID_WIFI, payload_array, payload_len, command_array ); |
| kishino | 8:50d2509479cd | 187 | // Set data for response |
| kishino | 8:50d2509479cd | 188 | mUartCommand.setCommandID( UART_CMD_ID_WIFI ); |
| kishino | 8:50d2509479cd | 189 | mUartCommand.setCommandSID( UART_CMD_SID_WIFI_JOIN_REQ ); |
| kishino | 8:50d2509479cd | 190 | mUartCommand.setResponseBuf( payload_buf->buf ); |
| kishino | 8:50d2509479cd | 191 | |
| kishino | 8:50d2509479cd | 192 | // Send uart command request |
| kishino | 8:50d2509479cd | 193 | sendUart( command_len, command_array ); |
| kishino | 8:50d2509479cd | 194 | |
| kishino | 8:50d2509479cd | 195 | // Wait UART response |
| kishino | 8:50d2509479cd | 196 | ret = mUartCommand.wait(); |
| kishino | 8:50d2509479cd | 197 | if( ret != 0 ) |
| kishino | 8:50d2509479cd | 198 | { |
| kishino | 8:50d2509479cd | 199 | printf( "join failed\r\n" ); |
| kishino | 9:a98b45e766c8 | 200 | freeCmdBuf( payload_buf ); |
| kishino | 8:50d2509479cd | 201 | return -1; |
| kishino | 8:50d2509479cd | 202 | } |
| kishino | 8:50d2509479cd | 203 | |
| kishino | 8:50d2509479cd | 204 | if( mUartCommand.getCommandStatus() != 0 ) |
| kishino | 8:50d2509479cd | 205 | { |
| kishino | 8:50d2509479cd | 206 | printf("join status:%02x\r\n", mUartCommand.getCommandStatus()); |
| kishino | 8:50d2509479cd | 207 | ret = -1; |
| kishino | 8:50d2509479cd | 208 | } |
| kishino | 9:a98b45e766c8 | 209 | freeCmdBuf( payload_buf ); |
| kishino | 8:50d2509479cd | 210 | |
| kishino | 8:50d2509479cd | 211 | return ret; |
| kishino | 8:50d2509479cd | 212 | } |
| kishino | 8:50d2509479cd | 213 | |
| kishino | 8:50d2509479cd | 214 | int C_SNICwifiInterface::disconnect() |
| kishino | 8:50d2509479cd | 215 | { |
| kishino | 9:a98b45e766c8 | 216 | // Get buffer for response payload from MemoryPool |
| kishino | 9:a98b45e766c8 | 217 | tagMEMPOOL_BLOCK_T *payload_buf = getAlocCmdBuf(); |
| kishino | 8:50d2509479cd | 218 | if( payload_buf == NULL ) |
| kishino | 8:50d2509479cd | 219 | { |
| kishino | 8:50d2509479cd | 220 | printf("disconnect payload_buf NULL\r\n"); |
| kishino | 8:50d2509479cd | 221 | return -1; |
| kishino | 8:50d2509479cd | 222 | } |
| kishino | 8:50d2509479cd | 223 | |
| kishino | 8:50d2509479cd | 224 | tagWIFI_DISCONNECT_REQ_T req; |
| kishino | 8:50d2509479cd | 225 | unsigned char payload_array[UART_REQUEST_PAYLOAD_MAX]; |
| kishino | 8:50d2509479cd | 226 | unsigned char command_array[UART_REQUEST_PAYLOAD_MAX]; |
| kishino | 8:50d2509479cd | 227 | unsigned short payload_len; |
| kishino | 8:50d2509479cd | 228 | unsigned int command_len; |
| kishino | 8:50d2509479cd | 229 | int ret; |
| kishino | 8:50d2509479cd | 230 | |
| kishino | 8:50d2509479cd | 231 | // Make request |
| kishino | 8:50d2509479cd | 232 | req.cmd_sid = UART_CMD_SID_WIFI_DISCONNECT_REQ; |
| kishino | 8:50d2509479cd | 233 | req.seq = mUartRequestSeq++; |
| kishino | 8:50d2509479cd | 234 | |
| kishino | 8:50d2509479cd | 235 | // Make command payload |
| kishino | 8:50d2509479cd | 236 | payload_len = C_SNIC_UartMsg::makePayload( sizeof(tagWIFI_DISCONNECT_REQ_T), (unsigned char *)&req, payload_array ); |
| kishino | 8:50d2509479cd | 237 | // Make all command request |
| kishino | 8:50d2509479cd | 238 | command_len = C_SNIC_UartMsg::makeRequest( UART_CMD_ID_WIFI, payload_array, payload_len, command_array ); |
| kishino | 8:50d2509479cd | 239 | |
| kishino | 8:50d2509479cd | 240 | // Set data for response |
| kishino | 8:50d2509479cd | 241 | mUartCommand.setCommandID( UART_CMD_ID_WIFI ); |
| kishino | 8:50d2509479cd | 242 | mUartCommand.setCommandSID( req.cmd_sid ); |
| kishino | 8:50d2509479cd | 243 | mUartCommand.setResponseBuf( payload_buf->buf ); |
| kishino | 8:50d2509479cd | 244 | |
| kishino | 8:50d2509479cd | 245 | // Send uart command request |
| kishino | 8:50d2509479cd | 246 | sendUart( command_len, command_array ); |
| kishino | 8:50d2509479cd | 247 | |
| kishino | 8:50d2509479cd | 248 | // Wait UART response |
| kishino | 8:50d2509479cd | 249 | ret = mUartCommand.wait(); |
| kishino | 8:50d2509479cd | 250 | if( ret != 0 ) |
| kishino | 8:50d2509479cd | 251 | { |
| kishino | 8:50d2509479cd | 252 | printf( "disconnect failed\r\n" ); |
| kishino | 9:a98b45e766c8 | 253 | freeCmdBuf( payload_buf ); |
| kishino | 8:50d2509479cd | 254 | return -1; |
| kishino | 8:50d2509479cd | 255 | } |
| kishino | 8:50d2509479cd | 256 | |
| kishino | 8:50d2509479cd | 257 | if( mUartCommand.getCommandStatus() != 0 ) |
| kishino | 8:50d2509479cd | 258 | { |
| kishino | 8:50d2509479cd | 259 | printf("disconnect status:%02x\r\n", mUartCommand.getCommandStatus()); |
| kishino | 8:50d2509479cd | 260 | ret = -1; |
| kishino | 8:50d2509479cd | 261 | } |
| kishino | 9:a98b45e766c8 | 262 | freeCmdBuf( payload_buf ); |
| kishino | 8:50d2509479cd | 263 | return ret; |
| kishino | 8:50d2509479cd | 264 | } |
| kishino | 8:50d2509479cd | 265 | |
| kishino | 8:50d2509479cd | 266 | int C_SNICwifiInterface::scan( const char *ssid_p, unsigned char *bssid_p |
| kishino | 8:50d2509479cd | 267 | , void (*result_handler_p)(tagSCAN_RESULT_T *scan_result) ) |
| kishino | 8:50d2509479cd | 268 | { |
| kishino | 9:a98b45e766c8 | 269 | // Get buffer for response payload from MemoryPool |
| kishino | 9:a98b45e766c8 | 270 | tagMEMPOOL_BLOCK_T *payload_buf = getAlocCmdBuf(); |
| kishino | 8:50d2509479cd | 271 | if( payload_buf == NULL ) |
| kishino | 8:50d2509479cd | 272 | { |
| kishino | 8:50d2509479cd | 273 | printf("scan payload_buf NULL\r\n"); |
| kishino | 8:50d2509479cd | 274 | return -1; |
| kishino | 8:50d2509479cd | 275 | } |
| kishino | 8:50d2509479cd | 276 | |
| kishino | 8:50d2509479cd | 277 | tagWIFI_SCAN_REQ_T req; |
| kishino | 8:50d2509479cd | 278 | unsigned char payload_array[UART_REQUEST_PAYLOAD_MAX]; |
| kishino | 8:50d2509479cd | 279 | unsigned char command_array[UART_REQUEST_PAYLOAD_MAX]; |
| kishino | 8:50d2509479cd | 280 | unsigned short payload_len; |
| kishino | 8:50d2509479cd | 281 | unsigned int command_len; |
| kishino | 8:50d2509479cd | 282 | unsigned int buf_len = 0; |
| kishino | 8:50d2509479cd | 283 | int ret; |
| kishino | 8:50d2509479cd | 284 | |
| kishino | 8:50d2509479cd | 285 | memset( &req, 0, sizeof(tagWIFI_SCAN_REQ_T) ); |
| kishino | 8:50d2509479cd | 286 | // Make request |
| kishino | 8:50d2509479cd | 287 | req.cmd_sid = UART_CMD_SID_WIFI_SCAN_REQ; |
| kishino | 8:50d2509479cd | 288 | buf_len++; |
| kishino | 8:50d2509479cd | 289 | req.seq = mUartRequestSeq++; |
| kishino | 8:50d2509479cd | 290 | buf_len++; |
| kishino | 8:50d2509479cd | 291 | |
| kishino | 8:50d2509479cd | 292 | // Set scan type(Active scan) |
| kishino | 8:50d2509479cd | 293 | req.scan_type = 0; |
| kishino | 8:50d2509479cd | 294 | buf_len++; |
| kishino | 8:50d2509479cd | 295 | // Set bss type(any) |
| kishino | 8:50d2509479cd | 296 | req.bss_type = 2; |
| kishino | 8:50d2509479cd | 297 | buf_len++; |
| kishino | 8:50d2509479cd | 298 | // Set BSSID |
| kishino | 8:50d2509479cd | 299 | if( bssid_p != NULL ) |
| kishino | 8:50d2509479cd | 300 | { |
| kishino | 8:50d2509479cd | 301 | memcpy( req.bssid, bssid_p, BSSID_MAC_LENTH ); |
| kishino | 8:50d2509479cd | 302 | } |
| kishino | 8:50d2509479cd | 303 | buf_len += BSSID_MAC_LENTH; |
| kishino | 8:50d2509479cd | 304 | // Set channel list(0) |
| kishino | 8:50d2509479cd | 305 | req.chan_list = 0; |
| kishino | 8:50d2509479cd | 306 | buf_len++; |
| kishino | 8:50d2509479cd | 307 | //Set SSID |
| kishino | 8:50d2509479cd | 308 | if( ssid_p != NULL ) |
| kishino | 8:50d2509479cd | 309 | { |
| kishino | 8:50d2509479cd | 310 | strcpy( (char *)req.ssid, ssid_p ); |
| kishino | 8:50d2509479cd | 311 | buf_len += strlen(ssid_p); |
| kishino | 8:50d2509479cd | 312 | } |
| kishino | 8:50d2509479cd | 313 | buf_len++; |
| kishino | 8:50d2509479cd | 314 | |
| kishino | 8:50d2509479cd | 315 | // Make command payload |
| kishino | 8:50d2509479cd | 316 | payload_len = C_SNIC_UartMsg::makePayload( buf_len, (unsigned char *)&req, payload_array ); |
| kishino | 8:50d2509479cd | 317 | |
| kishino | 8:50d2509479cd | 318 | // Make all command request |
| kishino | 8:50d2509479cd | 319 | command_len = C_SNIC_UartMsg::makeRequest( UART_CMD_ID_WIFI, payload_array, payload_len, command_array ); |
| kishino | 8:50d2509479cd | 320 | |
| kishino | 8:50d2509479cd | 321 | // Set data for response |
| kishino | 8:50d2509479cd | 322 | mUartCommand.setCommandID( UART_CMD_ID_WIFI ); |
| kishino | 8:50d2509479cd | 323 | mUartCommand.setCommandSID( req.cmd_sid ); |
| kishino | 8:50d2509479cd | 324 | mUartCommand.setResponseBuf( payload_buf->buf ); |
| kishino | 8:50d2509479cd | 325 | // Set scan result callback |
| kishino | 8:50d2509479cd | 326 | mUartCommand.setScanResultHandler( result_handler_p ); |
| kishino | 8:50d2509479cd | 327 | |
| kishino | 8:50d2509479cd | 328 | // Send uart command request |
| kishino | 8:50d2509479cd | 329 | sendUart( command_len, command_array ); |
| kishino | 8:50d2509479cd | 330 | |
| kishino | 8:50d2509479cd | 331 | // Wait UART response |
| kishino | 8:50d2509479cd | 332 | ret = mUartCommand.wait(); |
| kishino | 8:50d2509479cd | 333 | printf( "scan wait:%d\r\n", ret ); |
| kishino | 8:50d2509479cd | 334 | if( ret != 0 ) |
| kishino | 8:50d2509479cd | 335 | { |
| kishino | 8:50d2509479cd | 336 | printf( "scan failed\r\n" ); |
| kishino | 9:a98b45e766c8 | 337 | freeCmdBuf( payload_buf ); |
| kishino | 8:50d2509479cd | 338 | return -1; |
| kishino | 8:50d2509479cd | 339 | } |
| kishino | 8:50d2509479cd | 340 | |
| kishino | 8:50d2509479cd | 341 | if( mUartCommand.getCommandStatus() != 0 ) |
| kishino | 8:50d2509479cd | 342 | { |
| kishino | 8:50d2509479cd | 343 | printf("scan status:%02x\r\n", mUartCommand.getCommandStatus()); |
| kishino | 8:50d2509479cd | 344 | ret = -1; |
| kishino | 8:50d2509479cd | 345 | } |
| kishino | 8:50d2509479cd | 346 | |
| kishino | 9:a98b45e766c8 | 347 | freeCmdBuf( payload_buf ); |
| kishino | 8:50d2509479cd | 348 | |
| kishino | 8:50d2509479cd | 349 | return ret; |
| kishino | 8:50d2509479cd | 350 | } |
| kishino | 8:50d2509479cd | 351 | |
| kishino | 8:50d2509479cd | 352 | int C_SNICwifiInterface::wifi_on( const char *country_p ) |
| kishino | 8:50d2509479cd | 353 | { |
| kishino | 8:50d2509479cd | 354 | // Parameter check |
| kishino | 8:50d2509479cd | 355 | if( country_p == NULL ) |
| kishino | 8:50d2509479cd | 356 | { |
| kishino | 8:50d2509479cd | 357 | printf("wifi_on parameter error\r\n"); |
| kishino | 8:50d2509479cd | 358 | return -1; |
| kishino | 8:50d2509479cd | 359 | } |
| kishino | 8:50d2509479cd | 360 | |
| kishino | 9:a98b45e766c8 | 361 | // Get buffer for response payload from MemoryPool |
| kishino | 9:a98b45e766c8 | 362 | tagMEMPOOL_BLOCK_T *payload_buf = getAlocCmdBuf(); |
| kishino | 8:50d2509479cd | 363 | if( payload_buf == NULL ) |
| kishino | 8:50d2509479cd | 364 | { |
| kishino | 8:50d2509479cd | 365 | printf("wifi_on payload_buf NULL\r\n"); |
| kishino | 8:50d2509479cd | 366 | return -1; |
| kishino | 8:50d2509479cd | 367 | } |
| kishino | 8:50d2509479cd | 368 | |
| kishino | 8:50d2509479cd | 369 | tagWIFI_ON_REQ_T req; |
| kishino | 8:50d2509479cd | 370 | unsigned char payload_array[UART_REQUEST_PAYLOAD_MAX]; |
| kishino | 8:50d2509479cd | 371 | unsigned char command_array[UART_REQUEST_PAYLOAD_MAX]; |
| kishino | 8:50d2509479cd | 372 | unsigned short payload_len; |
| kishino | 8:50d2509479cd | 373 | unsigned int command_len; |
| kishino | 8:50d2509479cd | 374 | int ret; |
| kishino | 8:50d2509479cd | 375 | |
| kishino | 8:50d2509479cd | 376 | // Make request |
| kishino | 8:50d2509479cd | 377 | req.cmd_sid = UART_CMD_SID_WIFI_ON_REQ; |
| kishino | 8:50d2509479cd | 378 | req.seq = mUartRequestSeq++; |
| kishino | 8:50d2509479cd | 379 | memcpy( req.country, country_p, COUNTRYC_CODE_LENTH ); |
| kishino | 8:50d2509479cd | 380 | |
| kishino | 8:50d2509479cd | 381 | // Make command payload |
| kishino | 8:50d2509479cd | 382 | payload_len = C_SNIC_UartMsg::makePayload( sizeof(tagWIFI_ON_REQ_T), (unsigned char *)&req, payload_array ); |
| kishino | 8:50d2509479cd | 383 | // Make all command request |
| kishino | 8:50d2509479cd | 384 | command_len = C_SNIC_UartMsg::makeRequest( UART_CMD_ID_WIFI, payload_array, payload_len, command_array ); |
| kishino | 8:50d2509479cd | 385 | |
| kishino | 8:50d2509479cd | 386 | // Set data for response |
| kishino | 8:50d2509479cd | 387 | mUartCommand.setCommandID( UART_CMD_ID_WIFI ); |
| kishino | 8:50d2509479cd | 388 | mUartCommand.setCommandSID( req.cmd_sid ); |
| kishino | 8:50d2509479cd | 389 | mUartCommand.setResponseBuf( payload_buf->buf ); |
| kishino | 8:50d2509479cd | 390 | |
| kishino | 8:50d2509479cd | 391 | // Send uart command request |
| kishino | 8:50d2509479cd | 392 | sendUart( command_len, command_array ); |
| kishino | 8:50d2509479cd | 393 | |
| kishino | 8:50d2509479cd | 394 | // Wait UART response |
| kishino | 8:50d2509479cd | 395 | ret = mUartCommand.wait(); |
| kishino | 8:50d2509479cd | 396 | if( ret != 0 ) |
| kishino | 8:50d2509479cd | 397 | { |
| kishino | 8:50d2509479cd | 398 | printf( "wifi_on failed\r\n" ); |
| kishino | 9:a98b45e766c8 | 399 | freeCmdBuf( payload_buf ); |
| kishino | 8:50d2509479cd | 400 | return -1; |
| kishino | 8:50d2509479cd | 401 | } |
| kishino | 8:50d2509479cd | 402 | |
| kishino | 8:50d2509479cd | 403 | if( mUartCommand.getCommandStatus() != 0 ) |
| kishino | 8:50d2509479cd | 404 | { |
| kishino | 8:50d2509479cd | 405 | printf("wifi_on status:%02x\r\n", mUartCommand.getCommandStatus()); |
| kishino | 8:50d2509479cd | 406 | ret = -1; |
| kishino | 8:50d2509479cd | 407 | } |
| kishino | 9:a98b45e766c8 | 408 | freeCmdBuf( payload_buf ); |
| kishino | 8:50d2509479cd | 409 | |
| kishino | 8:50d2509479cd | 410 | return ret; |
| kishino | 8:50d2509479cd | 411 | } |
| kishino | 8:50d2509479cd | 412 | |
| kishino | 8:50d2509479cd | 413 | int C_SNICwifiInterface::wifi_off() |
| kishino | 8:50d2509479cd | 414 | { |
| kishino | 9:a98b45e766c8 | 415 | // Get buffer for response payload from MemoryPool |
| kishino | 9:a98b45e766c8 | 416 | tagMEMPOOL_BLOCK_T *payload_buf = getAlocCmdBuf(); |
| kishino | 8:50d2509479cd | 417 | if( payload_buf == NULL ) |
| kishino | 8:50d2509479cd | 418 | { |
| kishino | 8:50d2509479cd | 419 | printf("wifi_off payload_buf NULL\r\n"); |
| kishino | 8:50d2509479cd | 420 | return -1; |
| kishino | 8:50d2509479cd | 421 | } |
| kishino | 8:50d2509479cd | 422 | |
| kishino | 8:50d2509479cd | 423 | tagWIFI_OFF_REQ_T req; |
| kishino | 8:50d2509479cd | 424 | unsigned char payload_array[UART_REQUEST_PAYLOAD_MAX]; |
| kishino | 8:50d2509479cd | 425 | unsigned char command_array[UART_REQUEST_PAYLOAD_MAX]; |
| kishino | 8:50d2509479cd | 426 | unsigned short payload_len; |
| kishino | 8:50d2509479cd | 427 | unsigned int command_len; |
| kishino | 8:50d2509479cd | 428 | int ret; |
| kishino | 8:50d2509479cd | 429 | |
| kishino | 8:50d2509479cd | 430 | // Make request |
| kishino | 8:50d2509479cd | 431 | req.cmd_sid = UART_CMD_SID_WIFI_OFF_REQ; |
| kishino | 8:50d2509479cd | 432 | req.seq = mUartRequestSeq++; |
| kishino | 8:50d2509479cd | 433 | |
| kishino | 8:50d2509479cd | 434 | // Make command payload |
| kishino | 8:50d2509479cd | 435 | payload_len = C_SNIC_UartMsg::makePayload( sizeof(tagWIFI_OFF_REQ_T), (unsigned char *)&req, payload_array ); |
| kishino | 8:50d2509479cd | 436 | // Make all command request |
| kishino | 8:50d2509479cd | 437 | command_len = C_SNIC_UartMsg::makeRequest( UART_CMD_ID_WIFI, payload_array, payload_len, command_array ); |
| kishino | 8:50d2509479cd | 438 | |
| kishino | 8:50d2509479cd | 439 | // Set data for response |
| kishino | 8:50d2509479cd | 440 | mUartCommand.setCommandID( UART_CMD_ID_WIFI ); |
| kishino | 8:50d2509479cd | 441 | mUartCommand.setCommandSID( req.cmd_sid ); |
| kishino | 8:50d2509479cd | 442 | mUartCommand.setResponseBuf( payload_buf->buf ); |
| kishino | 8:50d2509479cd | 443 | |
| kishino | 8:50d2509479cd | 444 | // Send uart command request |
| kishino | 8:50d2509479cd | 445 | sendUart( command_len, command_array ); |
| kishino | 8:50d2509479cd | 446 | |
| kishino | 8:50d2509479cd | 447 | // Wait UART response |
| kishino | 8:50d2509479cd | 448 | ret = mUartCommand.wait(); |
| kishino | 8:50d2509479cd | 449 | if( ret != 0 ) |
| kishino | 8:50d2509479cd | 450 | { |
| kishino | 8:50d2509479cd | 451 | printf( "wifi_off failed\r\n" ); |
| kishino | 9:a98b45e766c8 | 452 | freeCmdBuf( payload_buf ); |
| kishino | 8:50d2509479cd | 453 | return -1; |
| kishino | 8:50d2509479cd | 454 | } |
| kishino | 8:50d2509479cd | 455 | |
| kishino | 8:50d2509479cd | 456 | if( mUartCommand.getCommandStatus() != 0 ) |
| kishino | 8:50d2509479cd | 457 | { |
| kishino | 8:50d2509479cd | 458 | printf("wifi_off status:%02x\r\n", mUartCommand.getCommandStatus()); |
| kishino | 8:50d2509479cd | 459 | ret = -1; |
| kishino | 8:50d2509479cd | 460 | } |
| kishino | 9:a98b45e766c8 | 461 | freeCmdBuf( payload_buf ); |
| kishino | 8:50d2509479cd | 462 | |
| kishino | 8:50d2509479cd | 463 | return ret; |
| kishino | 8:50d2509479cd | 464 | } |
| kishino | 8:50d2509479cd | 465 | |
| kishino | 8:50d2509479cd | 466 | int C_SNICwifiInterface::getRssi( signed char *rssi_p ) |
| kishino | 8:50d2509479cd | 467 | { |
| kishino | 8:50d2509479cd | 468 | if( rssi_p == NULL ) |
| kishino | 8:50d2509479cd | 469 | { |
| kishino | 8:50d2509479cd | 470 | printf("getRssi parameter error\r\n"); |
| kishino | 8:50d2509479cd | 471 | return -1; |
| kishino | 8:50d2509479cd | 472 | } |
| kishino | 8:50d2509479cd | 473 | |
| kishino | 8:50d2509479cd | 474 | // Get buffer for response payload from MemoryPool |
| kishino | 9:a98b45e766c8 | 475 | tagMEMPOOL_BLOCK_T *payload_buf = getAlocCmdBuf(); |
| kishino | 8:50d2509479cd | 476 | if( payload_buf == NULL ) |
| kishino | 8:50d2509479cd | 477 | { |
| kishino | 8:50d2509479cd | 478 | printf("getRssi payload_buf NULL\r\n"); |
| kishino | 8:50d2509479cd | 479 | return -1; |
| kishino | 8:50d2509479cd | 480 | } |
| kishino | 8:50d2509479cd | 481 | |
| kishino | 8:50d2509479cd | 482 | tagWIFI_GET_STA_RSSI_REQ_T req; |
| kishino | 8:50d2509479cd | 483 | unsigned char payload_array[UART_REQUEST_PAYLOAD_MAX]; |
| kishino | 8:50d2509479cd | 484 | unsigned char command_array[UART_REQUEST_PAYLOAD_MAX]; |
| kishino | 8:50d2509479cd | 485 | unsigned short payload_len; |
| kishino | 8:50d2509479cd | 486 | unsigned int command_len; |
| kishino | 8:50d2509479cd | 487 | int ret; |
| kishino | 8:50d2509479cd | 488 | |
| kishino | 8:50d2509479cd | 489 | // Make request |
| kishino | 8:50d2509479cd | 490 | req.cmd_sid = UART_CMD_SID_WIFI_GET_STA_RSSI_REQ; |
| kishino | 8:50d2509479cd | 491 | req.seq = mUartRequestSeq++; |
| kishino | 8:50d2509479cd | 492 | |
| kishino | 8:50d2509479cd | 493 | // Make command payload |
| kishino | 8:50d2509479cd | 494 | payload_len = C_SNIC_UartMsg::makePayload( sizeof(tagWIFI_GET_STA_RSSI_REQ_T), (unsigned char *)&req, payload_array ); |
| kishino | 8:50d2509479cd | 495 | // Make all command request |
| kishino | 8:50d2509479cd | 496 | command_len = C_SNIC_UartMsg::makeRequest( UART_CMD_ID_WIFI, payload_array, payload_len, command_array ); |
| kishino | 8:50d2509479cd | 497 | |
| kishino | 8:50d2509479cd | 498 | // Set data for response |
| kishino | 8:50d2509479cd | 499 | mUartCommand.setCommandID( UART_CMD_ID_WIFI ); |
| kishino | 8:50d2509479cd | 500 | mUartCommand.setCommandSID( req.cmd_sid ); |
| kishino | 8:50d2509479cd | 501 | mUartCommand.setResponseBuf( payload_buf->buf ); |
| kishino | 8:50d2509479cd | 502 | |
| kishino | 8:50d2509479cd | 503 | // Send uart command request |
| kishino | 8:50d2509479cd | 504 | sendUart( command_len, command_array ); |
| kishino | 8:50d2509479cd | 505 | |
| kishino | 8:50d2509479cd | 506 | // Wait UART response |
| kishino | 8:50d2509479cd | 507 | ret = mUartCommand.wait(); |
| kishino | 8:50d2509479cd | 508 | if( ret != 0 ) |
| kishino | 8:50d2509479cd | 509 | { |
| kishino | 8:50d2509479cd | 510 | printf( "getRssi failed\r\n" ); |
| kishino | 9:a98b45e766c8 | 511 | freeCmdBuf( payload_buf ); |
| kishino | 8:50d2509479cd | 512 | return -1; |
| kishino | 8:50d2509479cd | 513 | } |
| kishino | 8:50d2509479cd | 514 | |
| kishino | 8:50d2509479cd | 515 | *rssi_p = (signed char)payload_buf->buf[2]; |
| kishino | 8:50d2509479cd | 516 | |
| kishino | 9:a98b45e766c8 | 517 | freeCmdBuf( payload_buf ); |
| kishino | 8:50d2509479cd | 518 | return 0; |
| kishino | 8:50d2509479cd | 519 | } |
| kishino | 8:50d2509479cd | 520 | |
| kishino | 8:50d2509479cd | 521 | int C_SNICwifiInterface::getWifiStatus( tagWIFI_STATUS_T *status_p) |
| kishino | 8:50d2509479cd | 522 | { |
| kishino | 8:50d2509479cd | 523 | if( status_p == NULL ) |
| kishino | 8:50d2509479cd | 524 | { |
| kishino | 8:50d2509479cd | 525 | printf("getWifiStatus parameter error\r\n"); |
| kishino | 8:50d2509479cd | 526 | return -1; |
| kishino | 8:50d2509479cd | 527 | } |
| kishino | 8:50d2509479cd | 528 | |
| kishino | 8:50d2509479cd | 529 | // Get buffer for response payload from MemoryPool |
| kishino | 9:a98b45e766c8 | 530 | tagMEMPOOL_BLOCK_T *payload_buf = getAlocCmdBuf(); |
| kishino | 8:50d2509479cd | 531 | if( payload_buf == NULL ) |
| kishino | 8:50d2509479cd | 532 | { |
| kishino | 8:50d2509479cd | 533 | printf("getWifiStatus payload_buf NULL\r\n"); |
| kishino | 8:50d2509479cd | 534 | return -1; |
| kishino | 8:50d2509479cd | 535 | } |
| kishino | 8:50d2509479cd | 536 | |
| kishino | 8:50d2509479cd | 537 | tagWIFI_GET_STATUS_REQ_T req; |
| kishino | 8:50d2509479cd | 538 | unsigned char payload_array[UART_REQUEST_PAYLOAD_MAX]; |
| kishino | 8:50d2509479cd | 539 | unsigned char command_array[UART_REQUEST_PAYLOAD_MAX]; |
| kishino | 8:50d2509479cd | 540 | unsigned short payload_len; |
| kishino | 8:50d2509479cd | 541 | unsigned int command_len; |
| kishino | 8:50d2509479cd | 542 | int ret; |
| kishino | 8:50d2509479cd | 543 | |
| kishino | 8:50d2509479cd | 544 | // Make request |
| kishino | 8:50d2509479cd | 545 | req.cmd_sid = UART_CMD_SID_WIFI_GET_STATUS_REQ; |
| kishino | 8:50d2509479cd | 546 | req.seq = mUartRequestSeq++; |
| kishino | 8:50d2509479cd | 547 | req.interface = 0; |
| kishino | 8:50d2509479cd | 548 | |
| kishino | 8:50d2509479cd | 549 | // Make command payload |
| kishino | 8:50d2509479cd | 550 | payload_len = C_SNIC_UartMsg::makePayload( sizeof(tagWIFI_GET_STATUS_REQ_T), (unsigned char *)&req, payload_array ); |
| kishino | 8:50d2509479cd | 551 | // Make all command request |
| kishino | 8:50d2509479cd | 552 | command_len = C_SNIC_UartMsg::makeRequest( UART_CMD_ID_WIFI, payload_array, payload_len, command_array ); |
| kishino | 8:50d2509479cd | 553 | |
| kishino | 8:50d2509479cd | 554 | // Set data for response |
| kishino | 8:50d2509479cd | 555 | mUartCommand.setCommandID( UART_CMD_ID_WIFI ); |
| kishino | 8:50d2509479cd | 556 | mUartCommand.setCommandSID( req.cmd_sid ); |
| kishino | 8:50d2509479cd | 557 | mUartCommand.setResponseBuf( payload_buf->buf ); |
| kishino | 8:50d2509479cd | 558 | |
| kishino | 8:50d2509479cd | 559 | // Send uart command request |
| kishino | 8:50d2509479cd | 560 | sendUart( command_len, command_array ); |
| kishino | 8:50d2509479cd | 561 | |
| kishino | 8:50d2509479cd | 562 | // Wait UART response |
| kishino | 8:50d2509479cd | 563 | ret = mUartCommand.wait(); |
| kishino | 8:50d2509479cd | 564 | if( ret != 0 ) |
| kishino | 8:50d2509479cd | 565 | { |
| kishino | 8:50d2509479cd | 566 | printf( "getWifiStatus failed\r\n" ); |
| kishino | 9:a98b45e766c8 | 567 | freeCmdBuf( payload_buf ); |
| kishino | 8:50d2509479cd | 568 | return -1; |
| kishino | 8:50d2509479cd | 569 | } |
| kishino | 8:50d2509479cd | 570 | |
| kishino | 8:50d2509479cd | 571 | // set status |
| kishino | 8:50d2509479cd | 572 | status_p->status = (E_WIFI_STATUS)payload_buf->buf[2]; |
| kishino | 8:50d2509479cd | 573 | |
| kishino | 8:50d2509479cd | 574 | // set Mac address |
| kishino | 8:50d2509479cd | 575 | if( status_p->status != e_STATUS_OFF ) |
| kishino | 8:50d2509479cd | 576 | { |
| kishino | 8:50d2509479cd | 577 | memcpy( status_p->mac_address, &payload_buf->buf[3], BSSID_MAC_LENTH ); |
| kishino | 8:50d2509479cd | 578 | } |
| kishino | 8:50d2509479cd | 579 | |
| kishino | 8:50d2509479cd | 580 | // set SSID |
| kishino | 8:50d2509479cd | 581 | if( ( status_p->status == e_STA_JOINED ) == ( status_p->status == e_AP_STARTED ) ) |
| kishino | 8:50d2509479cd | 582 | { |
| kishino | 8:50d2509479cd | 583 | memcpy( status_p->ssid, &payload_buf->buf[9], strlen( (char *)&payload_buf->buf[9]) ); |
| kishino | 8:50d2509479cd | 584 | } |
| kishino | 8:50d2509479cd | 585 | |
| kishino | 9:a98b45e766c8 | 586 | freeCmdBuf( payload_buf ); |
| kishino | 8:50d2509479cd | 587 | return 0; |
| kishino | 8:50d2509479cd | 588 | } |
muRata

Murata TypeYD