Ignore:
Timestamp:
Feb 1, 2019, 9:57:09 PM (5 years ago)
Author:
coas-nagasima
Message:

TINETとSocket APIなどを更新

File:
1 edited

Legend:

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

    r337 r364  
    3939#define _CLIENT_H_
    4040
    41 #include <kernel.h>
    42 #include "target_kernel_impl.h"
     41typedef struct client_info_t {
     42        char client_id[80];
     43        char client_secret[32];
     44} client_info_t;
    4345
    44 #define CLIENT_PRIORITY         4               /* クライアントタスクの優先度 */
     46typedef struct credential_t {
     47        char device_code[100];
     48        char user_code[12];
     49        int expires_in;
     50        int interval;
     51        char verification_url[32];
     52        char access_token[132];
     53        char refresh_token[64];
     54        char scope[64];
     55        char token_type[16];
     56} credential_t;
    4557
    46 #define CLIENT_STACK_SIZE       6144    /* スタック領域のサイズ */
     58typedef struct error_response_t {
     59        char error[64];
     60        char error_description[64];
     61} error_response_t;
    4762
    48 extern void client_init(void);
    49 extern void client_task(intptr_t exinf);
    50 extern void client_fin(void);
     63typedef struct drive_file_t {
     64        char kind[32];
     65        char id[36];
     66        char name[256];
     67        char mimeType[40];
     68} drive_file_t;
     69
     70typedef enum google_drive_parse_state_t {
     71        psRoot,
     72        psDeviceCode,
     73        psUserCode,
     74        psExpiresIn,
     75        psInterval,
     76        psVerificationUrl,
     77        psAccessToken,
     78        psRefreshToken,
     79        psScope,
     80        psTokenType,
     81        psKind,
     82        psId,
     83        psName,
     84        psMimeType,
     85        psError,
     86        psErrorDescription,
     87} google_drive_parse_state_t;
     88
     89struct jsonsl_st;
     90typedef struct jsonsl_st *jsonsl_t;
     91
     92typedef void (*parser_callback_t)(struct google_drive_t *gd, struct jsonsl_state_st *state, const char *buf);
     93
     94typedef struct google_drive_t {
     95        client_info_t client_info;
     96        credential_t credential;
     97        drive_file_t file;
     98        error_response_t error;
     99        jsonsl_t jsn;
     100        google_drive_parse_state_t state;
     101        char fname[sizeof("1:/log/20160101000000.log")];
     102        char jsn_buf[256];
     103        int jsn_buf_pos;
     104        parser_callback_t start;
     105        parser_callback_t end;
     106} google_drive_t;
     107
     108extern google_drive_t google_drive;
     109
     110void client_init(void);
     111void client_final(void);
     112
     113void client_set_client_id(const char *client_id);
     114void client_set_client_secret(const char *client_secret);
     115int client_get_device_id(int argc, char **argv);
     116int client_get_access_token(int argc, char **argv);
     117int client_update_access_token(int argc, char **argv);
     118int client_revoke(int argc, char **argv);
     119int client_upload_file(int argc, char **argv);
    51120
    52121#endif /* _CLIENT_H_ */
Note: See TracChangeset for help on using the changeset viewer.