// This function pushes data onto the Parse Application in cloud. It is invoked by updateIntensity(). void *threadPushNotifications() { pthread_detach(pthread_self()); //ParseClient client = parseInitialize("kayWALfBm6h1SQdANXoZtTZqA0N9sZsB7cwUUVod", "7Nw0R9LTDXR7lRhmPsArePQMralFW8Yt7DL2zWTS"); ParseClient client = parseInitialize("TSexah1prtbhpF6w4dellQ2XYWyk2bqcljOiElrN", "xLnvnzcTMO1w9MwuFNBTO6hLjOtnKmZn4iz4SBnu"); char *installationId = parseGetInstallationId(client); /* We need to set the InstallationId forcefully. Setting installationId to dataUUID based on null string is incorrect logic as there is a possibility that the installationId was previously set to some junk value. Typically this will break the push notification subscription */ parseSetInstallationId(client, dataUUID); printf("lightbulb::threadPushNotifications():New Installation ID set to : %s\n", installationId); printf("lightbulb::threadPushNotifications():Installation ID is : %s\n", installationId); parseSetPushCallback(client, healthCallback); parseStartPushService(client); parseRunPushLoop(client); printf("Somewhere in threadPushNotifications()\n"); }
/** * \brief Main application function. * * Application entry point. * * \return program return value. */ int main(void) { char ssid[] = "YOUR_NETWORK_ID"; char pw[] = "YOUR_NETWORK_PASS"; /* 0 - no security, 1 - WEP, 2 - WPA */ int secType = 2; /* Initialize the board. */ system_init(); /* Initialize the UART console. */ configure_console(); printf(STRING_HEADER); /* Configure Non-Volatile Memory */ configure_nvm(); if (LOCAL_PARSE_SUCCESS != initWifiModule()) { printf("main / initWifiModule Error !!!!!\r\n"); return -1; } loadSettingsOrProvisionBoard(ssid, pw, secType); while (1) { if (M2M_WIFI_MODE_STA == localParseEventLoop(NULL)) { printf("main / WiFi connection is done\r\n"); break; } } parseClient = parseInitialize(YOUR_APP_ID, YOUR_CLIENT_ID); if (parseClient) { printf("main / parseClient 0x%x\r\n", parseClient ); while (1) { parseRunPushLoop(parseClient); } } return 0; }