Okundu Omeni
/
wifi-https-ble-sm-uart-atcmd-5-13-1
this is using the mbed os version 5-13-1
Diff: source/WiFiManager.h
- Branch:
- PassingRegression
- Revision:
- 127:a21788227ca6
- Parent:
- 124:eae4512b131b
- Child:
- 128:3a641aaad2d9
--- a/source/WiFiManager.h Sun Jul 07 20:36:41 2019 +0000 +++ b/source/WiFiManager.h Mon Jul 15 21:37:22 2019 +0000 @@ -16,6 +16,21 @@ #include "https_certificates.h" #include "common_types.h" //const char HELLO_MSG[] = +#define TOKEN_RESPONSE_SIZE 5*1024 +#define ID_TOKEN_SIZE 1024 +#define REFRESH_TOKEN_SIZE 2*1024 +#define ID_TOKEN_STR_START "\"IdToken\":\"" +#define REFRESH_TOKEN_STR_START "\"RefreshToken\":\"" +#define ACCESS_TOKEN_STR_END "\",\"" + +const char TOKEN_REQ_HDR[] = "POST / HTTP1.1\r\n" + "Host: cognito-idp.eu-west-2.amazonaws.com\r\n" + "X-Amz-Target: AWSCognitoIdentityProviderService.InitiateAuth\r\n" + "Content-Type: application/x-amz-json-1.1"; +const char UserName[] = "box1"; +const char Password[] = "DnaN2dg3B4x!"; +const char AuthFlow[] = "USER_PASSWORD_AUTH"; +const char ClientId[] = "3el1h42i52p0e1gkb0l86ougdv"; const uint8_t HELLO_MSG[] = {0x50,0x4f ,0x53,0x54,0x20,0x2f,0x6e,0x75,0x64,0x67 @@ -106,6 +121,9 @@ http_result_t http_result; bool use_full_hostname; int keep_alive_id; + bool https_request_succeeded; + char * aws_id_token; + char * aws_refresh_token; #ifdef DNANUDGE_DEBUG rtos::Semaphore callback_semaphore; @@ -163,6 +181,8 @@ bool outputBuffersAvailable(); void callInternetKeepAlive(); void keepSocketAlive(); + void CreateTokenHttpsRequest(char * httpsReq); + void GetCloudAccessToken();