Changeset 350 for asp3_tinet_ecnl_rx
- Timestamp:
- May 8, 2018, 7:06:30 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
asp3_tinet_ecnl_rx/trunk/app1_usb_watt_meter/src/client.c
r342 r350 47 47 #include "kernel_cfg.h" 48 48 #include "ff.h" 49 #include "util/ntstdio.h" 49 50 50 51 #define SKIP_PEER_VERIFICATION 51 52 //#define SKIP_HOSTNAME_VERIFICATION 52 53 char response[80]; 54 extern ntstdio_t ntstdio; 53 55 54 56 void client_init(void) … … 74 76 response[len] = '\0'; 75 77 76 syslog(LOG_NOTICE, response);78 ntstdio_printf(&ntstdio, response); 77 79 78 80 dly_tsk(100 * 1000); … … 108 110 response[len] = '\0'; 109 111 110 syslog(LOG_NOTICE, response);112 ntstdio_printf(&ntstdio, response); 111 113 112 114 dly_tsk(100); … … 183 185 ret = f_open(&file, fname, FA_CREATE_ALWAYS | FA_WRITE); 184 186 if (ret != FR_OK) { 185 syslog(LOG_ERROR, "not open a upload file %d", ret);187 ntstdio_printf(&ntstdio, "not open a upload file %d\n", ret); 186 188 return ret; 187 189 } … … 251 253 ret = write_log(fname); 252 254 if (ret != FR_OK) { 253 syslog(LOG_ERROR, "log file write error %d", ret);255 ntstdio_printf(&ntstdio, "log file write error %d\n", ret); 254 256 return; 255 257 } … … 257 259 ret = f_open(&file, fname, FA_READ); 258 260 if (ret != FR_OK) { 259 syslog(LOG_ERROR, "log file open error %d", ret);261 ntstdio_printf(&ntstdio, "log file open error %d\n", ret); 260 262 return; 261 263 } 262 264 263 syslog(LOG_NOTICE, "cURL start");265 ntstdio_printf(&ntstdio, "cURL start\n"); 264 266 265 267 curl = curl_easy_init(); 266 268 if (curl == NULL) { 267 syslog(LOG_ERROR, "curl_easy_init() failed\n");269 ntstdio_printf(&ntstdio, "curl_easy_init() failed\n"); 268 270 goto file_close; 269 271 } … … 274 276 res = curl_easy_setopt(curl, CURLOPT_URL, "https://www.example.com/"); 275 277 if (res != CURLE_OK) 276 syslog(LOG_ERROR, "CURLOPT_URL failed: %s\n",278 ntstdio_printf(&ntstdio, "CURLOPT_URL failed: %s\n", 277 279 curl_easy_strerror(res)); 278 280 … … 296 298 res = curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0L); 297 299 if (res != CURLE_OK) 298 syslog(LOG_ERROR, "CURLOPT_SSL_VERIFYPEER failed: %s\n",300 ntstdio_printf(&ntstdio, "CURLOPT_SSL_VERIFYPEER failed: %s\n", 299 301 curl_easy_strerror(res)); 300 302 #else 301 303 res = curl_easy_setopt(curl, CURLOPT_CAINFO, "0:/certs/ca-cert.pem"); 302 304 if (res != CURLE_OK) 303 syslog(LOG_ERROR, "CURLOPT_CAINFO failed: %s\n",305 ntstdio_printf(&ntstdio, "CURLOPT_CAINFO failed: %s\n", 304 306 curl_easy_strerror(res)); 305 307 306 308 res = curl_easy_setopt(curl, CURLOPT_SSLCERT, "0:/certs/client-cert.pem"); 307 309 if (res != CURLE_OK) 308 syslog(LOG_ERROR, "CURLOPT_SSLCERT failed: %s\n",310 ntstdio_printf(&ntstdio, "CURLOPT_SSLCERT failed: %s\n", 309 311 curl_easy_strerror(res)); 310 312 311 313 res = curl_easy_setopt(curl, CURLOPT_SSLKEY, "0:/certs/client-key.pem"); 312 314 if (res != CURLE_OK) 313 syslog(LOG_ERROR, "CURLOPT_SSLKEY failed: %s\n",315 ntstdio_printf(&ntstdio, "CURLOPT_SSLKEY failed: %s\n", 314 316 curl_easy_strerror(res)); 315 317 #endif … … 324 326 res = curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0L); 325 327 if (res != CURLE_OK) 326 syslog(LOG_ERROR, "CURLOPT_SSL_VERIFYHOST failed: %s\n",328 ntstdio_printf(&ntstdio, "CURLOPT_SSL_VERIFYHOST failed: %s\n", 327 329 curl_easy_strerror(res)); 328 330 #endif … … 330 332 /*res = curl_easy_setopt(curl, CURLOPT_PROXY, "https://proxy.example.com:8080"); 331 333 if (res != CURLE_OK) 332 syslog(LOG_ERROR, "CURLOPT_PROXY failed: %s\n",334 ntstdio_printf(&ntstdio, "CURLOPT_PROXY failed: %s\n", 333 335 curl_easy_strerror(res));*/ 334 336 … … 356 358 curl_easy_setopt(curl, CURLOPT_READFUNCTION, read_data); 357 359 358 syslog(LOG_NOTICE, "cURL perform the request");360 ntstdio_printf(&ntstdio, "cURL perform the request\n"); 359 361 tslp_tsk(100 * 1000); 360 362 … … 363 365 /* Check for errors */ 364 366 if (res != CURLE_OK) { 365 syslog(LOG_ERROR, "curl_easy_perform() failed: %s\n",366 curl_easy_strerror(res)); 367 syslog(LOG_ERROR, errbuf);367 ntstdio_printf(&ntstdio, "curl_easy_perform() failed: %s\n", 368 curl_easy_strerror(res)); 369 ntstdio_printf(&ntstdio, errbuf); 368 370 } 369 371 … … 371 373 curl_easy_cleanup(curl); 372 374 373 syslog(LOG_NOTICE, "cURL end");375 ntstdio_printf(&ntstdio, "cURL end\n"); 374 376 375 377 file_close:
Note:
See TracChangeset
for help on using the changeset viewer.