thincloud.h
IoT_Error_t tc_init(AWS_IoT_Client *client, char *hostAddr, char *rootCAPath, char *clientCRTPath, char *clientKeyPath, iot_disconnect_handler handler, void *disconnectData)
{
    IoT_Client_Init_Params params = iotClientInitParamsDefault;

    params.enableAutoReconnect = false; // We enable this on connect
    params.pHostURL = hostAddr;
    params.port = 443; // Default MQTT port
    params.pRootCALocation = rootCAPath;
    params.pDeviceCertLocation = clientCRTPath;
    params.pDevicePrivateKeyLocation = clientKeyPath;
    params.mqttCommandTimeout_ms = 20000;
    params.tlsHandshakeTimeout_ms = 5000;
    params.isSSLHostnameVerify = true;
    params.disconnectHandler = handler;
    params.disconnectHandlerData = disconnectData;

    return aws_iot_mqtt_init(client, &params);
}
/**
 * @brief Initialize an AWS IoT Client 
 * 
 * Initialize an AWS IoT Client instance with ThinCloud specific parameters and defaults.
 * 
 * @param[in]  client          AWS IoT MQTT Client instance.
 * @param[in]  hostAddr        ThinCloud host address. 
 * @param[in]  rootCAPath      Path to a root CA.
 * @param[in]  clientCRTPath   Path to a client CRT.
 * @param[in]  clientKeyPath   Path to a client private key.
 * @param[in]  handler         Disconnect handler.
 * @param[in]  disconnectData  Data blob to be passed to the disconnect handler on invoke.
 * 
 * @return Zero on success, negative value otherwise 
 */
@brief Initialize an AWS IoT Client

Initialize an AWS IoT Client instance with ThinCloud specific parameters and defaults.

@param[in]  client          AWS IoT MQTT Client instance.
@param[in]  hostAddr        ThinCloud host address.
@param[in]  rootCAPath      Path to a root CA.
@param[in]  clientCRTPath   Path to a client CRT.
@param[in]  clientKeyPath   Path to a client private key.
@param[in]  handler         Disconnect handler.
@param[in]  disconnectData  Data blob to be passed to the disconnect handler on invoke.

@return Zero on success, negative value otherwise
@brief Initialize an AWS IoT Client Initialize an AWS IoT Client instance with ThinCloud specific parameters and defaults . @param [ in ] client AWS IoT MQTT Client instance . @param [ in ] hostAddr ThinCloud host address . @param [ in ] rootCAPath Path to a root CA . @param [ in ] clientCRTPath Path to a client CRT . @param [ in ] clientKeyPath Path to a client private key . @param [ in ] handler Disconnect handler . @param [ in ] disconnectData Data blob to be passed to the disconnect handler on invoke . @return Zero on success negative value otherwise
IoT_Error_t tc_init(AWS_IoT_Client *client, char *hostAddr, char *rootCAPath, char *clientCRTPath, char *clientKeyPath, iot_disconnect_handler handler, void *disconnectData)
{
    IoT_Client_Init_Params params = iotClientInitParamsDefault;
    params.enableAutoReconnect = false; 
    params.pHostURL = hostAddr;
    params.port = 443; 
    params.pRootCALocation = rootCAPath;
    params.pDeviceCertLocation = clientCRTPath;
    params.pDevicePrivateKeyLocation = clientKeyPath;
    params.mqttCommandTimeout_ms = 20000;
    params.tlsHandshakeTimeout_ms = 5000;
    params.isSSLHostnameVerify = true;
    params.disconnectHandler = handler;
    params.disconnectHandlerData = disconnectData;
    return aws_iot_mqtt_init(client, &params);
}
IoT_Error_t tc_init ( AWS_IoT_Client * client , char * hostAddr , char * rootCAPath , char * clientCRTPath , char * clientKeyPath , iot_disconnect_handler handler , void * disconnectData ) { IoT_Client_Init_Params params = iotClientInitParamsDefault ; params . enableAutoReconnect = false ; params . pHostURL = hostAddr ; params . port = 443 ; params . pRootCALocation = rootCAPath ; params . pDeviceCertLocation = clientCRTPath ; params . pDevicePrivateKeyLocation = clientKeyPath ; params . mqttCommandTimeout_ms = 20000 ; params . tlsHandshakeTimeout_ms = 5000 ; params . isSSLHostnameVerify = true ; params . disconnectHandler = handler ; params . disconnectHandlerData = disconnectData ; return aws_iot_mqtt_init ( client , & params ) ; }
@brief Initialize an AWS IoT Client
@brief Initialize an AWS IoT Client
// We enable this on connect // Default MQTT port