Changeset 396


Ignore:
Timestamp:
May 28, 2019, 3:22:09 PM (5 years ago)
Author:
coas-nagasima
Message:

動かないがMQTTを追加

Location:
azure_iot_hub/trunk
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • azure_iot_hub/trunk/app_iothub_client/src/client.c

    r393 r396  
    1717#include "iothub_message.h"
    1818#include "iothubtransporthttp.h"
     19#include "iothubtransportmqtt.h"
    1920#include "iothubtransportmqtt_websockets.h"
    2021
     
    131132        EVENT_INSTANCE* eventInstance = (EVENT_INSTANCE*)userContextCallback;
    132133
    133         (void)printf("Confirmation[%d] received for message tracking id = %zu with result = %s\r\n", callbackCounter, eventInstance->messageTrackingId, MU_ENUM_TO_STRING(IOTHUB_CLIENT_CONFIRMATION_RESULT, result));
     134        (void)printf("Confirmation[%d] received for message tracking id = %u with result = %s\r\n", callbackCounter, eventInstance->messageTrackingId, MU_ENUM_TO_STRING(IOTHUB_CLIENT_CONFIRMATION_RESULT, result));
    134135
    135136        /* Some device specific action code goes here... */
     
    138139}
    139140
    140 void iothub_client_run(void)
     141void iothub_client_run(int proto)
    141142{
    142143        IOTHUB_CLIENT_LL_HANDLE iotHubClientHandle;
     
    160161        else
    161162        {
    162 #if 1
    163                 (void)printf("Starting the IoTHub client sample HTTP...\r\n");
    164                 IOTHUB_CLIENT_TRANSPORT_PROVIDER protocol = HTTP_Protocol;
    165 #else
    166                 (void)printf("Starting the IoTHub client sample MQTT...\r\n");
    167                 IOTHUB_CLIENT_TRANSPORT_PROVIDER protocol = MQTT_WebSocket_Protocol;
    168 #endif
     163                IOTHUB_CLIENT_TRANSPORT_PROVIDER protocol;
     164                switch (proto) {
     165                case 0:
     166                        (void)printf("Starting the IoTHub client sample HTTP...\r\n");
     167                        protocol = HTTP_Protocol;
     168                        break;
     169                case 1:
     170                        (void)printf("Starting the IoTHub client sample MQTT...\r\n");
     171                        protocol = MQTT_Protocol;
     172                        break;
     173                case 2:
     174                        (void)printf("Starting the IoTHub client sample MQTT over WebSocket...\r\n");
     175                        protocol = MQTT_WebSocket_Protocol;
     176                        break;
     177                default:
     178                        platform_deinit();
     179                        return;
     180                }
    169181
    170182                if ((iotHubClientHandle = IoTHubClient_LL_CreateFromConnectionString(connectionString, protocol)) == NULL)
     
    294306int iothub_client_main(int argc, char **argv)
    295307{
    296         iothub_client_run();
     308        iothub_client_run(0);
    297309        return 0;
    298310}
  • azure_iot_hub/trunk/app_iothub_client/src/main.c

    r392 r396  
    171171static void main_initialize()
    172172{
    173         FILINFO fno;
    174 #if FF_USE_LFN
    175         char lfn[FF_MAX_LFN + 1];
    176         fno.lfname = lfn;
    177         fno.lfsize = FF_MAX_LFN + 1;
    178 #endif
    179173        ER ret;
    180174
  • azure_iot_hub/trunk/azure_iothub/iothub_client/src/iothub_client_ll_uploadtoblob.c

    r389 r396  
    832832                                            {
    833833                                                req_string = STRING_construct_sprintf("{\"isSuccess\":%s, \"statusCode\":%d, \"statusDescription\":""}", ((httpResponse < 300) ? "true" : "false"), httpResponse);
    834                                                 }
     834                                            }
    835835                                            else
    836836                                            {
Note: See TracChangeset for help on using the changeset viewer.