Strictly necessary cookies are on by default and cannot be turned off. Functional, Performance and Tracking/targeting/sharing cookies can be turned on below based on your preferences (this banner will remain available for you to accept cookies). You may change your cookie settings by deleting cookies from your browser. Then this banner will appear again. You can learn more details about cookies HERE.
Strictly necessary (always on)
Functional, Performance and Tracking/targeting/sharing (default off)
The answer to this question for the now depreciated library is pretty basic. I've noticed a couple of problems with the old library, but currently no show stoppers. First, it is necessary to fix three lines of code in "MQTTWiced.c". In functions "wiced_mqtt_connect", "wiced_mqtt_subscribe" and "wicked_mqtt_publish", modify the return line to: "return ( rc == MQTT_FAILURE ) ? WICED_ERROR : WICED_SUCCESS;". In function "wiced_read" change the last statement from "return result;" to "return -1;" This fixes another problem.
This fixes a logic issue. In "wicked_lib.c" modify the very last statement from "return -1;" to "return error;". This fixes a logic error in that code.
Finally, the following code works perfect to my MQTT server with a self signed CA certificate. I need to point out that this code has the original google CA certificate and that is worthless. For this code to work, you'll need to use openSSL to generate your own self signed certificate and server certificates.
The basic code looks like this:
void application_start( )
unsigned char buf[ 100 ];
unsigned char readbuf[ 100 ];
const char* peer_cn = MQTT_TARGET_IP;
wiced_init( ); // Set up the WICED core and the WLAN connection
/* Initialize MQTT */
wiced_mqtt_init( &mqtt_network ); //set up function pointers