The Pubnub C-core library. It's home is on https://github.com/pubnub/c_core, this is a copy

Dependents:   Pubnub_c_core_mbed2_pal Pubnub_c_core_mbed2_pal Pubnub_c_core_mbed2_pal2

Committer:
sveljko
Date:
Tue Nov 22 22:21:39 2016 +0000
Revision:
2:d85e42c1125d
Parent:
0:d13755cfb705
Added `pubnub_helper` module

Who changed what in which revision?

UserRevisionLine numberNew contents of line
sveljko 0:d13755cfb705 1 /* -*- c-file-style:"stroustrup"; indent-tabs-mode: nil -*- */
sveljko 0:d13755cfb705 2
sveljko 0:d13755cfb705 3 /** This macro does the common "stuff to do" on the outcome of a
sveljko 0:d13755cfb705 4 transaction. Should be used by all `pbntf_trans_outcome()`
sveljko 0:d13755cfb705 5 functions.
sveljko 0:d13755cfb705 6
sveljko 0:d13755cfb705 7 In case of PubNub protocol error, resets the time-token. This means
sveljko 0:d13755cfb705 8 some messages were (possibly) lost, but allows us to recover from bad
sveljko 0:d13755cfb705 9 situations, e.g. too many messages queued or unexpected problem caused
sveljko 0:d13755cfb705 10 by a particular message.
sveljko 0:d13755cfb705 11 */
sveljko 0:d13755cfb705 12 #define PBNTF_TRANS_OUTCOME_COMMON(pb) do { \
sveljko 0:d13755cfb705 13 enum pubnub_res M_pbrslt_ = (pb)->core.last_result; \
sveljko 0:d13755cfb705 14 PUBNUB_LOG_INFO("Pubnub Transaction outcome: %d\n", M_pbrslt_); \
sveljko 0:d13755cfb705 15 switch (M_pbrslt_) { \
sveljko 0:d13755cfb705 16 case PNR_FORMAT_ERROR: \
sveljko 0:d13755cfb705 17 case PNR_TIMEOUT: \
sveljko 0:d13755cfb705 18 case PNR_IO_ERROR: \
sveljko 0:d13755cfb705 19 (pb)->core.timetoken[0] = '0'; \
sveljko 0:d13755cfb705 20 (pb)->core.timetoken[1] = '\0'; \
sveljko 0:d13755cfb705 21 break; \
sveljko 0:d13755cfb705 22 default: \
sveljko 0:d13755cfb705 23 break; \
sveljko 0:d13755cfb705 24 } \
sveljko 0:d13755cfb705 25 (pb)->state = PBS_IDLE; \
sveljko 0:d13755cfb705 26 } while(0)