Exemplo n.º 1
0
int main(/*int argc, char* argv[] */)
{   

    printf("\r\nConfiguration demo started\n");

    /**
     * Initialize Kaa client.
     */
      
    kaa_error_t error_code = kaa_client_create(&kaa_client, NULL);
    KAA_DEMO_RETURN_IF_ERROR(error_code, "Failed create Kaa client");
    

    kaa_configuration_root_receiver_t receiver = { NULL, &kaa_demo_configuration_receiver };
    error_code = kaa_configuration_manager_set_root_receiver(kaa_client_get_context(kaa_client)->configuration_manager, &receiver);
    KAA_DEMO_RETURN_IF_ERROR(error_code, "Failed to add configuration receiver");

    kaa_demo_print_configuration_message(kaa_configuration_manager_get_configuration(kaa_client_get_context(kaa_client)->configuration_manager));

    /**
     * Start Kaa client main loop.
     */
    error_code = kaa_client_start(kaa_client, NULL, NULL, 0);
    KAA_DEMO_RETURN_IF_ERROR(error_code, "Failed to start Kaa main loop");

    /**
     * Destroy Kaa client.
     */
    kaa_client_destroy(kaa_client);

    printf("Configuration demo stopped\n");
    return error_code;
}
Exemplo n.º 2
0
int main(/*int argc, char *argv[]*/)
{
    printf("Cassandra data analytics demo started\n");

    if (wiringPiSetup() == -1) {
        printf("Failed to initialize Pi wiring\n");
        exit(1);
    }

    kaa_client_t *kaa_client = NULL;

    void *log_storage_context         = NULL;
    void *log_upload_strategy_context = NULL;

    /**
     * Initialize Kaa client.
     */
    kaa_error_t error_code = kaa_client_create(&kaa_client, NULL);
    KAA_DEMO_RETURN_IF_ERROR(error_code, "Failed create Kaa client");

    /**
     * Configure Kaa data collection module.
     */
    error_code = ext_unlimited_log_storage_create(&log_storage_context, kaa_client_get_context(kaa_client)->logger);
    KAA_DEMO_RETURN_IF_ERROR(error_code, "Failed to create unlimited log storage");

    error_code = ext_log_upload_strategy_create(kaa_client_get_context(kaa_client), &log_upload_strategy_context, KAA_LOG_UPLOAD_VOLUME_STRATEGY);
    KAA_DEMO_RETURN_IF_ERROR(error_code, "Failed to create log upload strategy");

    error_code = ext_log_upload_strategy_set_threshold_count(log_upload_strategy_context, KAA_DEMO_UPLOAD_COUNT_THRESHOLD);
    KAA_DEMO_RETURN_IF_ERROR(error_code, "Failed to set threshold log record count");

    kaa_log_bucket_constraints_t bucket_sizes = {
        .max_bucket_size = MAX_LOG_BUCKET_SIZE,
        .max_bucket_log_count = MAX_LOG_COUNT,
    };

    error_code = kaa_logging_init(kaa_client_get_context(kaa_client)->log_collector
                                , log_storage_context
                                , log_upload_strategy_context
                                , &bucket_sizes);
    KAA_DEMO_RETURN_IF_ERROR(error_code, "Failed to init Kaa log collector");

    /**
     * Start Kaa client main loop.
     */
    error_code = kaa_client_start(kaa_client, &kaa_demo_add_log_record, (void *)kaa_client, KAA_DEMO_LOG_GENERATION_FREQUENCY);
    KAA_DEMO_RETURN_IF_ERROR(error_code, "Failed to start Kaa main loop");

    /**
     * Destroy Kaa client.
     */
    kaa_client_destroy(kaa_client);

    printf("Cassandra data analytics demo stopped\n");

    return error_code;
}
Exemplo n.º 3
0
int main(/*int argc, char *argv[]*/) {
    /**
     * Initialise a board
     */
    int ret = target_initialise();
    if (ret < 0) {
        /* If console is failed to initialise, you will not see this message */
        demo_printf("Failed to initialise a target\n");
        return 1;
    }

    demo_printf("Configuration demo started\n");

    /**
     * Initialize Kaa client.
     */
    kaa_error_t error_code = kaa_client_create(&kaa_client, NULL);
    if (error_code) {
        demo_printf("Failed create Kaa client\n");
        return 2;
    }

    kaa_configuration_root_receiver_t receiver = {
            NULL,
            &kaa_demo_configuration_receiver
    };

    error_code = kaa_configuration_manager_set_root_receiver(
            kaa_client_get_context(kaa_client)->configuration_manager,
            &receiver);

    if (error_code) {
        demo_printf("Failed to add configuration receiver\n");
        return 3;
    }

    kaa_demo_print_configuration_message(
            kaa_configuration_manager_get_configuration(
                    kaa_client_get_context(kaa_client)->configuration_manager));

    /**
     * Start Kaa client main loop.
     */
    error_code = kaa_client_start(kaa_client, NULL, NULL, 0);
    if(error_code) {
        demo_printf("Failed to start Kaa main loop\n");
        return 4;
    }

    /**
     * Destroy Kaa client.
     */
    kaa_client_destroy(kaa_client);

    demo_printf("Configuration demo stopped\n");
    return 0;
}
Exemplo n.º 4
0
int main(/*int argc, char *argv[]*/)
{
    printf("Data collection demo started\n");
    kaa_log_bucket_constraints_t bucket_sizes = {
        .max_bucket_size       = KAA_DEMO_BUCKET_SIZE,
        .max_bucket_log_count  = KAA_DEMO_LOGS_IN_BUCKET,
    };

    /**
     * Initialize Kaa client.
     */
    kaa_error_t error_code = kaa_client_create(&kaa_client, NULL);
    KAA_DEMO_RETURN_IF_ERROR(error_code, "Failed create Kaa client");

    error_code = ext_limited_log_storage_create(&log_storage_context, kaa_client_get_context(kaa_client)->logger, KAA_DEMO_LOG_STORAGE_SIZE, KAA_DEMO_LOGS_TO_KEEP);
    KAA_DEMO_RETURN_IF_ERROR(error_code, "Failed to create limited log storage");

    error_code = ext_log_upload_strategy_create(kaa_client_get_context(kaa_client), &log_upload_strategy_context, KAA_LOG_UPLOAD_VOLUME_STRATEGY);
    KAA_DEMO_RETURN_IF_ERROR(error_code, "Failed to create log upload strategy");

    error_code = ext_log_upload_strategy_set_threshold_count(log_upload_strategy_context, KAA_DEMO_UPLOAD_COUNT_THRESHOLD);
    KAA_DEMO_RETURN_IF_ERROR(error_code, "Failed to set threshold log record count");

    error_code = kaa_logging_init(kaa_client_get_context(kaa_client)->log_collector
                                , log_storage_context
                                , log_upload_strategy_context
                                , &bucket_sizes);

    KAA_DEMO_RETURN_IF_ERROR(error_code, "Failed to init Kaa log collector");

    error_code = kaa_logging_set_listeners(kaa_client_get_context(kaa_client)->log_collector,
                                           &log_listener);
    KAA_DEMO_RETURN_IF_ERROR(error_code, "Failed to add log listeners");

    /**
     * Start Kaa client main loop.
     */
    error_code = kaa_client_start(kaa_client, &kaa_demo_add_log_record, (void *)kaa_client, KAA_DEMO_LOG_GENERATION_FREQUENCY);
    KAA_DEMO_RETURN_IF_ERROR(error_code, "Failed to start Kaa main loop");

    /**
     * Destroy Kaa client.
     */
    kaa_client_destroy(kaa_client);

    printf("Data collection demo stopped\n");

    return error_code;
}
Exemplo n.º 5
0
Arquivo: kaa_demo.c Projeto: xwiz/kaa
int main(/*int argc, char *argv[]*/)
{
    printf("Data collection demo started\n");

    /**
     * Initialize Kaa client.
     */
    kaa_error_t error_code = kaa_client_create(&kaa_client, NULL);
    KAA_DEMO_RETURN_IF_ERROR(error_code, "Failed create Kaa client");

    error_code = ext_unlimited_log_storage_create(&log_storage_context, kaa_client_get_context(kaa_client)->logger);
    KAA_DEMO_RETURN_IF_ERROR(error_code, "Failed to create unlimited log storage");

    error_code = ext_log_upload_strategy_by_volume_create(&log_upload_strategy_context
                                                        , kaa_client_get_context(kaa_client)->channel_manager
                                                        , kaa_client_get_context(kaa_client)->bootstrap_manager);
    KAA_DEMO_RETURN_IF_ERROR(error_code, "Failed to create log upload strategy");

    error_code = ext_log_upload_strategy_by_volume_set_threshold_count(log_upload_strategy_context
                                                                     , KAA_DEMO_UPLOAD_COUNT_THRESHOLD);
    KAA_DEMO_RETURN_IF_ERROR(error_code, "Failed to set threshold log record count");

    error_code = kaa_logging_init(kaa_client_get_context(kaa_client)->log_collector
                                , log_storage_context
                                , log_upload_strategy_context);
    KAA_DEMO_RETURN_IF_ERROR(error_code, "Failed to init Kaa log collector");

    /**
     * Start Kaa client main loop.
     */
    error_code = kaa_client_start(kaa_client, &kaa_demo_add_log_record, (void *)kaa_client, KAA_DEMO_LOG_GENERATION_FREQUENCY);
    KAA_DEMO_RETURN_IF_ERROR(error_code, "Failed to start Kaa main loop");

    /**
     * Destroy Kaa client.
     */
    kaa_client_destroy(kaa_client);

    printf("Data collection demo stopped\n");

    return error_code;
}
Exemplo n.º 6
0
void setup()
{
    pinMode(CH_PD, OUTPUT);
    pinMode(ESP8266_RST, OUTPUT);
    pinMode(BOARD_BUTTON_PIN, INPUT);
    pinMode(BOARD_LED_PIN, OUTPUT);
    pinMode(LEFT_LIGHT, OUTPUT);
    pinMode(RIGHT_LIGHT, OUTPUT);

    light_blink_counter = -1;
    systick_enable();

    esp8266_serial_init(&esp8266_serial, ESP_SERIAL, ESP_SERIAL_BAUD);
    if (!esp8266_serial) {
        debug("Serial Initialization failed, no memory\r\n");
        return;
    }

    RFID_READER.begin(RFID_BAUD_RATE);

    kaa_client_props_t props;
    props.serial = esp8266_serial;
    props.wifi_ssid = SSID;
    props.wifi_pswd = PWD;
    bool need_deallocation;
    ext_get_endpoint_public_key(&props.kaa_public_key, &props.kaa_public_key_length, &need_deallocation);
    kaa_error_t error = kaa_client_create(&kaa_client, &props);
    if (error) {
        debug("Failed to init Kaa client, error code %d\r\n", error);
        return;
    }

    error = kaa_user_manager_default_attach_to_user(kaa_client_get_context(kaa_client)->user_manager
                                                  , KAA_USER_ID
                                                  , KAA_USER_ACCESS_TOKEN);
    if (error) {
        debug("Failed to attach to user '%s', error code %d\r\n", KAA_USER_ID, error);
        return;
    }


}
Exemplo n.º 7
0
int main(/*int argc, char *argv[]*/)
{
#ifdef CC32XX
    BoardInit();
    wlan_configure();
    sl_Start(0, 0, 0);
    wlan_connect("<SSID>", "<PASSWORD>", SL_SEC_TYPE_WPA_WPA2);//Into <SSID> and <PASSWORD> put your access point name and password
#endif
    DEMO_LOG("Configuration demo started");

    /**
     * Initialize Kaa client.
     */
    kaa_error_t error_code = kaa_client_create(&kaa_client, NULL);
    KAA_DEMO_RETURN_IF_ERROR(error_code, "Failed create Kaa client");

    kaa_configuration_root_receiver_t receiver = { NULL, &kaa_demo_configuration_receiver };
    error_code = kaa_configuration_manager_set_root_receiver(kaa_client_get_context(kaa_client)->configuration_manager, &receiver);
    KAA_DEMO_RETURN_IF_ERROR(error_code, "Failed to add configuration receiver");

    kaa_demo_print_configuration_message(kaa_configuration_manager_get_configuration(kaa_client_get_context(kaa_client)->configuration_manager));

    /**
     * Start Kaa client main loop.
     */
    error_code = kaa_client_start(kaa_client, NULL, NULL, 0);
    KAA_DEMO_RETURN_IF_ERROR(error_code, "Failed to start Kaa main loop");

    /**
     * Destroy Kaa client.
     */
    kaa_client_destroy(kaa_client);

    DEMO_LOG("Configuration demo stopped");
    return error_code;
}
Exemplo n.º 8
0
int main(int argc, char *argv[])
{   
    if (argc != 5) {
        printf("Please, input + or - for audio, video and vibro supporting and directory for key storage. (Need 4 arguments)\n");
        exit(1);
    }
    
    mkdir(argv[4], 0777);
    chdir(argv[4]);

    /**
     * Initialize Kaa client.
     */
    kaa_error_t error_code = kaa_client_create(&kaa_client, NULL);
    if (error_code) {
        printf("Failed create Kaa client, error code %d\n", error_code);
        return EXIT_FAILURE;
    }
    
    kaa_profile_t *profile = kaa_profile_pager_client_profile_create();
    if (!profile) {
        printf("Failed to create profile\n");
        kaa_client_destroy(kaa_client);
        return EXIT_FAILURE;
    }
    
    const uint8_t *endpoint_key_hash = NULL;
    size_t endpoint_key_hash_length = 0;

    ext_get_sha1_base64_public(&endpoint_key_hash, &endpoint_key_hash_length);

    if (access(KAA_CONFIGURATION_STORAGE, F_OK) != -1) {
        printf("Waiting for new configuration for\n");
        printf("Endpoint ID %.*s\n", (int)endpoint_key_hash_length, endpoint_key_hash);
    }

    printf("- - -\n");
    printf("Endpoint ID %.*s\n", (int)endpoint_key_hash_length,
                endpoint_key_hash);


    profile->audio_support = set_client_parameter(argv[1]);
    profile->video_support = set_client_parameter(argv[2]);
    profile->vibro_support = set_client_parameter(argv[3]);

    printf("Profiling body (have audio-, video-, vibro-support):\n");
    printf("%s - %s - %s\n", profile->audio_support ? "true" : "false",
        profile->video_support ? "true" : "false",
        profile->vibro_support ? "true" : "false");

    error_code = kaa_profile_manager_update_profile(kaa_client_get_context(kaa_client)->profile_manager, profile);
    if (error_code) {
        printf("Failed to update profile, error code %d", error_code);
        kaa_client_destroy(kaa_client);
        return EXIT_FAILURE;
    }

    kaa_configuration_root_receiver_t receiver = {
        NULL,
        &kaa_demo_configuration_receiver,
    };

    error_code = kaa_configuration_manager_set_root_receiver(
        kaa_client_get_context(kaa_client)->configuration_manager,
        &receiver);
    if (error_code) {
        printf("Failed to add configuration receiver\n");
        kaa_client_destroy(kaa_client);
        return EXIT_FAILURE;
    }
    printf("Default configuration:\n");
    kaa_demo_print_configuration_message(
        kaa_configuration_manager_get_configuration(
            kaa_client_get_context(kaa_client)->configuration_manager));

    /**
     * Start Kaa client main loop.
     */
    error_code = kaa_client_start(kaa_client, NULL, NULL, 0);
    if (error_code) {
        printf("Failed to start Kaa main loop, error code %d\n", error_code);
        kaa_client_destroy(kaa_client);
        return EXIT_FAILURE;
    }
    
    /**
     * Destroy Kaa client.
     */
    kaa_client_destroy(kaa_client);

    return EXIT_SUCCESS;
}
Exemplo n.º 9
0
int main(/*int argc, char *argv[]*/)
{
    log_info("Fan demo started");
    
    initFan(true);

    /**
     * Initialize Kaa client.
     */
    kaa_error_t error_code = kaa_client_create(&kaa_client, NULL);
    KAA_DEMO_RETURN_IF_ERROR(error_code, "Failed create Kaa client");

    kaa_attachment_status_listeners_t listeners = { NULL
                                                  , &kaa_on_attached
                                                  , &kaa_on_detached
                                                  , &kaa_on_attach_success
                                                  , &kaa_on_attach_failed };

    error_code = kaa_user_manager_set_attachment_listeners(kaa_client_get_context(kaa_client)->user_manager, &listeners);
    KAA_DEMO_RETURN_IF_ERROR(error_code, "Failed to set user attach status listener");

    error_code = kaa_profile_manager_set_endpoint_access_token(kaa_client_get_context(kaa_client)->profile_manager
                                                                                    , KAA_ENDPOINT_ACCESS_TOKEN);
    KAA_DEMO_RETURN_IF_ERROR(error_code, "Failed to set endpoint access token");

    error_code = kaa_event_manager_set_kaa_device_event_class_family_device_info_request_listener(
                        kaa_client_get_context(kaa_client)->event_manager, &kaa_on_device_info_request, NULL);
    KAA_DEMO_RETURN_IF_ERROR(error_code, "Failed to set device info request listener");

    error_code = kaa_event_manager_set_kaa_fan_event_class_family_switch_request_listener(
                        kaa_client_get_context(kaa_client)->event_manager, &kaa_on_switch_request, NULL);
    KAA_DEMO_RETURN_IF_ERROR(error_code, "Failed to set switch request listener");

    error_code = kaa_event_manager_set_kaa_device_event_class_family_device_change_name_request_listener(
                        kaa_client_get_context(kaa_client)->event_manager, &kaa_on_device_change_name_request, NULL);
    KAA_DEMO_RETURN_IF_ERROR(error_code, "Failed to set device change name request listener");

    error_code = kaa_event_manager_set_kaa_device_event_class_family_device_status_subscription_request_listener(
                        kaa_client_get_context(kaa_client)->event_manager, &kaa_on_device_status_subscription_request, NULL);
    KAA_DEMO_RETURN_IF_ERROR(error_code, "Failed to set device status subscription request listener");

    error_code = kaa_user_manager_default_attach_to_user(kaa_client_get_context(kaa_client)->user_manager
                                                                              , KAA_USER_ID
                                                                              , KAA_USER_ACCESS_TOKEN);
    KAA_DEMO_RETURN_IF_ERROR(error_code, "Failed to attach to user");

    /**
     * Start Kaa client main loop.
     */
    error_code = kaa_client_start(kaa_client, NULL, NULL, 0);
    KAA_DEMO_RETURN_IF_ERROR(error_code, "Failed to start Kaa main loop");

    /**
     * Destroy Kaa client.
     */
    kaa_client_destroy(kaa_client);
    initFan(false);

    log_info("Fan demo stopped");

    return error_code;
}
Exemplo n.º 10
0
int main(void)
{
    int rc = target_initialize();
    if (rc < 0) {
        return 1;
    }

    target_gpio_led_init();

    demo_printf("GPIO demo started\r\n");

    /**
     * Initialize Kaa client.
     */
    kaa_error_t error_code = kaa_client_create(&kaa_client, NULL);
    if (error_code) {
        demo_printf("Failed to create client context: %i\r\n", error_code);
        return 2;
    }

    error_code = kaa_profile_manager_set_endpoint_access_token(kaa_client_get_context(kaa_client)->profile_manager,
        DEMO_ACCESS_TOKEN);

    if (error_code) {
        demo_printf("Failed to set access token: %i\r\n", error_code);
        return 3;
    }

    error_code = kaa_event_manager_set_kaa_remote_control_ecf_device_info_request_listener(kaa_client_get_context(kaa_client)->event_manager,
            kaa_device_info_request,
            NULL);
    if (error_code) {
        demo_printf("Unable to set remote control listener: %i\r\n", error_code);
        return 4;
    }

    error_code = kaa_event_manager_set_kaa_remote_control_ecf_gpio_toggle_request_listener(kaa_client_get_context(kaa_client)->event_manager,
            kaa_GPIOToggle_info_request,
            NULL);
    if (error_code) {
        demo_printf("Unable to set GPIO listener: %i\r\n", error_code);
        return 5;
    }

    demo_printf("ACCESS_TOKEN :%s\r\n", DEMO_ACCESS_TOKEN);

    /**
     * Start Kaa client main loop.
     */
    error_code = kaa_client_start(kaa_client, kaa_external_process_fn, NULL, 0);
    if (error_code) {
        demo_printf("Unable to start Kaa client: %i\r\n", error_code);
        return 6;
    }

    /**
     * Destroy Kaa client.
     */
    kaa_client_destroy(kaa_client);

    demo_printf("GPIO demo stopped\r\n");

    return error_code;
}
Exemplo n.º 11
0
static void APP_main()
{
   ip_connected = false;
   kaa_started = false;

   kaa_error_t kaa_error = KAA_ERR_NONE;
   { //Used to limit kaa_props visibility, it creates on stack and release once is used
       kaa_client_props_t kaa_props;
       kaa_props.max_update_time = 2;
       kaa_error = kaa_client_create(&kaa_client, &kaa_props);
       if (kaa_error) {
           sndc_printf("Error %d initializing Kaa client \n",kaa_error);
           return;
       }
   }

   kaa_list_t *zones = kaa_list_create();
   int i = 0;
   for(; i < LIGHT_ZONES_COUNT; ++i) {
       sndc_io_setMode(light_zones[i], IO_MODE_OUTPUT);
       sndc_io_write(light_zones[i], LIGHT_OFF);
       int32_t *zone_id = (int32_t *) KAA_MALLOC(sizeof(int32_t));
       *zone_id = i;
       kaa_list_push_front(zones, zone_id);
   }
   kaa_profile_street_lights_profile_t *profile = kaa_profile_street_lights_profile_create();
   profile->light_zones = zones;
   kaa_profile_manager_update_profile(kaa_client_get_context(kaa_client)->profile_manager, profile);
   profile->destroy(profile);

   /**
    * Configuration example, below is how to configure and read default configuration values
    */
   kaa_configuration_root_receiver_t receiver = { NULL, &kaa_on_configuration_updated };
   kaa_error = kaa_configuration_manager_set_root_receiver(kaa_client_get_context(kaa_client)->configuration_manager, &receiver);
   sndc_printf("Configuration setting done. %d\n", kaa_error);
   //sndc_thrd_delay(TRACE_DELAY * SNDC_MILLISECOND);
   const kaa_root_configuration_t *root_config = kaa_configuration_manager_get_configuration(kaa_client_get_context(kaa_client)->configuration_manager);
   kaa_on_configuration_updated(NULL, root_config);

   //set SW2 button as key input
   //sndc_io_ctrl(BUTTON,
   //             IO_PIN_FUNC_PULL_UP,
   //             IO_PIN_DRIVE_DEFAULT,
   //             IO_PIN_SLEW_RATE_DEFAULT);
   //sndc_io_setMode(BUTTON, IO_MODE_KEY);

   //sndc_device_config = sndc_config_get();

   /* clean all profiles */
   //sndc_profile_eraseAll();
   //sndc_printf("Press SW2 to start test. \n");

   start_client();

   //infinite thread loop, button press is monitored by system events
   while(1)
   {

      if (ip_connected && !kaa_started) {
          kaa_client_start(kaa_client, NULL, NULL, 0);
          kaa_started = true;
      }
      //thread sleep for 500 ms
      sndc_thrd_delay(500 * SNDC_MILLISECOND);
   }
}
Exemplo n.º 12
0
int main(/*int argc, char *argv[]*/) {
    /**
     * Initialise a board
     */
    int ret = target_initialize();
    if (ret < 0) {
        /* If console is failed to initialise, you will not see this message */
        demo_printf("Failed to initialise a target\r\n");
        return EXIT_FAILURE;
    }

    demo_printf("Configuration demo started\r\n");

    /**
     * Initialize Kaa client.
     */
    kaa_error_t error_code = kaa_client_create(&kaa_client, NULL);
    if (error_code) {
        demo_printf("Failed create Kaa client\r\n");
        return EXIT_FAILURE;
    }

    /*
     * Set the handler for configuration updates.
     */
    kaa_configuration_root_receiver_t receiver = {
            NULL,
            &kaa_demo_configuration_receiver
    };

    error_code = kaa_configuration_manager_set_root_receiver(
            kaa_client_get_context(kaa_client)->configuration_manager,
            &receiver);

    if (error_code) {
        demo_printf("Failed to add configuration receiver\r\n");
        return EXIT_FAILURE;
    }

    /*
     * Display default configuration.
     */
    kaa_demo_print_configuration_message(
            kaa_configuration_manager_get_configuration(
                    kaa_client_get_context(kaa_client)->configuration_manager));

    /*
     * Obtain and display endpoint ID (represented by the EP key hash).
     */
    const uint8_t *endpoint_key_hash = NULL;
    size_t endpoint_key_hash_length = 0;

    ext_get_sha1_base64_public(&endpoint_key_hash, &endpoint_key_hash_length);

    printf("Endpoint ID: %.*s\r\n", (int)endpoint_key_hash_length,
            endpoint_key_hash);

    /**
     * Start Kaa client main loop.
     */
    error_code = kaa_client_start(kaa_client, NULL, NULL, 0);
    if(error_code) {
        demo_printf("Failed to start Kaa main loop\r\n");
        return EXIT_FAILURE;
    }

    /**
     * Destroy Kaa client.
     */
    kaa_client_destroy(kaa_client);

    return EXIT_SUCCESS;
}