Changeset 350


Ignore:
Timestamp:
May 8, 2018, 7:06:30 PM (6 years ago)
Author:
coas-nagasima
Message:

ログアップロード状況の出力をsyslogからntstdio_printfに変更

File:
1 edited

Legend:

Unmodified
Added
Removed
  • asp3_tinet_ecnl_rx/trunk/app1_usb_watt_meter/src/client.c

    r342 r350  
    4747#include "kernel_cfg.h"
    4848#include "ff.h"
     49#include "util/ntstdio.h"
    4950
    5051#define SKIP_PEER_VERIFICATION
    5152//#define SKIP_HOSTNAME_VERIFICATION
    5253char response[80];
     54extern ntstdio_t ntstdio;
    5355
    5456void client_init(void)
     
    7476                response[len] = '\0';
    7577
    76                 syslog(LOG_NOTICE, response);
     78                ntstdio_printf(&ntstdio, response);
    7779
    7880                dly_tsk(100 * 1000);
     
    108110                response[len] = '\0';
    109111
    110                 syslog(LOG_NOTICE, response);
     112                ntstdio_printf(&ntstdio, response);
    111113
    112114                dly_tsk(100);
     
    183185        ret = f_open(&file, fname, FA_CREATE_ALWAYS | FA_WRITE);
    184186        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);
    186188                return ret;
    187189        }
     
    251253        ret = write_log(fname);
    252254        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);
    254256                return;
    255257        }
     
    257259        ret = f_open(&file, fname, FA_READ);
    258260        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);
    260262                return;
    261263        }
    262264
    263         syslog(LOG_NOTICE, "cURL start");
     265        ntstdio_printf(&ntstdio, "cURL start\n");
    264266
    265267        curl = curl_easy_init();
    266268        if (curl == NULL) {
    267                 syslog(LOG_ERROR, "curl_easy_init() failed\n");
     269                ntstdio_printf(&ntstdio, "curl_easy_init() failed\n");
    268270                goto file_close;
    269271        }
     
    274276        res = curl_easy_setopt(curl, CURLOPT_URL, "https://www.example.com/");
    275277        if (res != CURLE_OK)
    276                 syslog(LOG_ERROR, "CURLOPT_URL failed: %s\n",
     278                ntstdio_printf(&ntstdio, "CURLOPT_URL failed: %s\n",
    277279                        curl_easy_strerror(res));
    278280
     
    296298        res = curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0L);
    297299        if (res != CURLE_OK)
    298                 syslog(LOG_ERROR, "CURLOPT_SSL_VERIFYPEER failed: %s\n",
     300                ntstdio_printf(&ntstdio, "CURLOPT_SSL_VERIFYPEER failed: %s\n",
    299301                        curl_easy_strerror(res));
    300302#else
    301303        res = curl_easy_setopt(curl, CURLOPT_CAINFO, "0:/certs/ca-cert.pem");
    302304        if (res != CURLE_OK)
    303                 syslog(LOG_ERROR, "CURLOPT_CAINFO failed: %s\n",
     305                ntstdio_printf(&ntstdio, "CURLOPT_CAINFO failed: %s\n",
    304306                        curl_easy_strerror(res));
    305307
    306308        res = curl_easy_setopt(curl, CURLOPT_SSLCERT, "0:/certs/client-cert.pem");
    307309        if (res != CURLE_OK)
    308                 syslog(LOG_ERROR, "CURLOPT_SSLCERT failed: %s\n",
     310                ntstdio_printf(&ntstdio, "CURLOPT_SSLCERT failed: %s\n",
    309311                        curl_easy_strerror(res));
    310312
    311313        res = curl_easy_setopt(curl, CURLOPT_SSLKEY, "0:/certs/client-key.pem");
    312314        if (res != CURLE_OK)
    313                 syslog(LOG_ERROR, "CURLOPT_SSLKEY failed: %s\n",
     315                ntstdio_printf(&ntstdio, "CURLOPT_SSLKEY failed: %s\n",
    314316                        curl_easy_strerror(res));
    315317#endif
     
    324326        res = curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0L);
    325327        if (res != CURLE_OK)
    326                 syslog(LOG_ERROR, "CURLOPT_SSL_VERIFYHOST failed: %s\n",
     328                ntstdio_printf(&ntstdio, "CURLOPT_SSL_VERIFYHOST failed: %s\n",
    327329                        curl_easy_strerror(res));
    328330#endif
     
    330332        /*res = curl_easy_setopt(curl, CURLOPT_PROXY, "https://proxy.example.com:8080");
    331333        if (res != CURLE_OK)
    332                 syslog(LOG_ERROR, "CURLOPT_PROXY failed: %s\n",
     334                ntstdio_printf(&ntstdio, "CURLOPT_PROXY failed: %s\n",
    333335                        curl_easy_strerror(res));*/
    334336
     
    356358        curl_easy_setopt(curl, CURLOPT_READFUNCTION, read_data);
    357359
    358         syslog(LOG_NOTICE, "cURL perform the request");
     360        ntstdio_printf(&ntstdio, "cURL perform the request\n");
    359361        tslp_tsk(100 * 1000);
    360362
     
    363365        /* Check for errors */
    364366        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);
    368370        }
    369371
     
    371373        curl_easy_cleanup(curl);
    372374
    373         syslog(LOG_NOTICE, "cURL end");
     375        ntstdio_printf(&ntstdio, "cURL end\n");
    374376
    375377file_close:
Note: See TracChangeset for help on using the changeset viewer.