


And you can see that the BLE started at the same time as AWS. In the screen shot below you can see that I moved the paddle to position 0. But you can see that when the game is over, you can still move the paddle using AWS console. I don’t really have a good program (like the GoBle) to test moving the paddle live. Wiced_rtos_push_to_queue(&paddleQueue,&msg,0) If(strncmp(WICED_TOPIC,(const char *)data->message.topic,strlen(WICED_TOPIC)) = 0 & data->message.data_length message.data,"%d",(int *)&val) WPRINT_APP_INFO( (" Payload Received:\n", (int)data->message.topic_length, data->message.topic ) ) Notice that I protect the game thread by making sure it send a value less than 100. You do this exactly the same way as you did in the BLE project. When you get a message to the PADDLE topic, you should parse it, then send a message to the game thread to move the paddle. Start by fixing the includes (just like we did in the BLE Example in Lesson 6) #include "SystemGlobal.h" In order for subscriber.c to be useful you need to fix the includes, send the messages from the PADDLE topic to the game thread, and turn application_start into a thread. Wiced_rtos_create_thread(&awsThreadHandle,7,"AWS Thread",awsThread,4096,0) Wiced_rtos_create_thread(&gameThreadHandle,7,"game Thread",gameThread,4096,0) Wiced_rtos_create_thread(&capsenseThreadHandle,7,"CapSense Thread",capSenseThread,1024,0) Wiced_rtos_create_thread(&blinkThreadHandle,7,"Blink Thread",pdlBlinkThread,500,0) Wiced_rtos_init_queue(&paddleQueue,"paddleQueue",sizeof(game_msg_t),10) wiced_thread_t awsThreadHandle įinally you should launch the AWS thread by creating it with wiced_rtos_create_thread. To integrate the awsThread thread into your main project you need to add the “subscriber.h” to the includes: #include "GameThread.h"Īdd a new variable to hold the awsThreadHandle.

#pragma onceĮxtern void awsThread( wiced_thread_arg_t arg ) Then you should define the awsThread function to match the wiced_thread_t function prototype (just a function that takes a wiced_thread_arg and returns void). In order for the main.c to know about the awsThread (which is the former application_start of subscriber.c) you should create a file called subscriber.h. WICED_CONFIG_DISABLE_ADVANCED_SECURITY_CURVES Create subscriber.h WICED_CONFIG_DISABLE_ENTERPRISE_SECURITY \ GLOBAL_DEFINES += WICED_CONFIG_DISABLE_SSL_SERVER \ # To support Low memory platforms, disabling components which are not required $(NAME)_RESOURCES := apps/aws/iot/rootca.cer \

Ble de fonty update#
Update the Makefile NAME := App_WStudio_L8GameBleAws Once done your folder should look like this: Use copy/paste to make a copy of the subscriber application and paste it into the GameBleAws project.
