This is the Pubnub library for MBed2 ("classic") with the "sync" interface. It is based on the Pubnub C-core library.

Dependencies:   Pubnub_c_core_mbed2_pal

Dependents:   Pubnub_ATT_IoT_SK_WNC_sync Pubnub_ATT_IOT_SK_WNC_AnalogIn_Issue Pubnub_ATT_IoT_SK_WNC_sync_3_27_Fork pubnub_sync

Committer:
sveljko
Date:
Fri Nov 11 22:46:57 2016 +0000
Revision:
2:4d49720c7200
Added the module/function to srand() using the time returned from Pubnub's `time` operation (which can be started with pubnub_time())

Who changed what in which revision?

UserRevisionLine numberNew contents of line
sveljko 2:4d49720c7200 1 #if !defined INC_SRAND_FROM_PUBNUB_TIME
sveljko 2:4d49720c7200 2 #define INC_SRAND_FROM_PUBNUB_TIME
sveljko 2:4d49720c7200 3
sveljko 2:4d49720c7200 4
sveljko 2:4d49720c7200 5 #include "pubnub_api_types.h"
sveljko 2:4d49720c7200 6
sveljko 2:4d49720c7200 7
sveljko 2:4d49720c7200 8 /** This helper function will call the C standard srand() function with the seed
sveljko 2:4d49720c7200 9 taken from the time returned from Pubnub's `time` operation (which can
sveljko 2:4d49720c7200 10 be initiated with pubnub_time()).
sveljko 2:4d49720c7200 11
sveljko 2:4d49720c7200 12 It's useful if you want a high-fidelity time used for srand() and on
sveljko 2:4d49720c7200 13 embedded system that don't have a Real-Time Clock.
sveljko 2:4d49720c7200 14
sveljko 2:4d49720c7200 15 Keep in mind that this requires a round-trip to Pubnub, so it will take
sveljko 2:4d49720c7200 16 some time, depending on your network, at least miliseconds. So, it's best
sveljko 2:4d49720c7200 17 used only once, at the start of your program.
sveljko 2:4d49720c7200 18
sveljko 2:4d49720c7200 19 @param pbp The Pubnub context to use to get time
sveljko 2:4d49720c7200 20 @return 0: OK, -1: error (srand() was not called)
sveljko 2:4d49720c7200 21 */
sveljko 2:4d49720c7200 22 int srand_from_pubnub_time(pubnub_t *pbp);
sveljko 2:4d49720c7200 23
sveljko 2:4d49720c7200 24
sveljko 2:4d49720c7200 25 #endif /* !defined INC_SRAND_FROM_PUBNUB_TIME */