publish final code
Dependencies: Pubnub_c_core_mbed2_pal2
Fork of Pubnub_mbed2_sync by
pubnub_ntf_sync.h@4:3ee9629861ab, 2017-02-21 (annotated)
- Committer:
- cswiger
- Date:
- Tue Feb 21 22:26:52 2017 +0000
- Revision:
- 4:3ee9629861ab
- Parent:
- 0:243e0d70a1d5
publish final code
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
sveljko | 0:243e0d70a1d5 | 1 | /* -*- c-file-style:"stroustrup"; indent-tabs-mode: nil -*- */ |
sveljko | 0:243e0d70a1d5 | 2 | #if !defined INC_PUBNUB_NTF_SYNC |
sveljko | 0:243e0d70a1d5 | 3 | #define INC_PUBNUB_NTF_SYNC |
sveljko | 0:243e0d70a1d5 | 4 | |
sveljko | 0:243e0d70a1d5 | 5 | |
sveljko | 0:243e0d70a1d5 | 6 | #include "pubnub_api_types.h" |
sveljko | 0:243e0d70a1d5 | 7 | |
sveljko | 0:243e0d70a1d5 | 8 | |
sveljko | 0:243e0d70a1d5 | 9 | /** @file pubnub_ntf_sync.h |
sveljko | 0:243e0d70a1d5 | 10 | This is the "sync" notification interface. |
sveljko | 0:243e0d70a1d5 | 11 | |
sveljko | 0:243e0d70a1d5 | 12 | Pubnub client library offers two "mostly portable" interfaces for |
sveljko | 0:243e0d70a1d5 | 13 | getting notification about the outcome of a Pubnub transaction. |
sveljko | 0:243e0d70a1d5 | 14 | Those are: |
sveljko | 0:243e0d70a1d5 | 15 | - sync (this one) |
sveljko | 0:243e0d70a1d5 | 16 | - callback |
sveljko | 0:243e0d70a1d5 | 17 | |
sveljko | 0:243e0d70a1d5 | 18 | There are others, which are specific to a platform (like process |
sveljko | 0:243e0d70a1d5 | 19 | events for Contiki OS). Also, not all platforms support the |
sveljko | 0:243e0d70a1d5 | 20 | two "mostly portable" interfaces mentioned above. |
sveljko | 0:243e0d70a1d5 | 21 | |
sveljko | 0:243e0d70a1d5 | 22 | Sync interfaces is the simplest. You just check for the (last) |
sveljko | 0:243e0d70a1d5 | 23 | result of a context (by using pubnub_last_result()) and when it |
sveljko | 0:243e0d70a1d5 | 24 | becomes something other than #PNR_STARTED, you have your |
sveljko | 0:243e0d70a1d5 | 25 | outcome. |
sveljko | 0:243e0d70a1d5 | 26 | |
sveljko | 0:243e0d70a1d5 | 27 | Since pubnub_last_result() is part of the "Core API", this |
sveljko | 0:243e0d70a1d5 | 28 | interface only provides one additional, helper function, which |
sveljko | 0:243e0d70a1d5 | 29 | will wait in a loop for the transaction to finish. While |
sveljko | 0:243e0d70a1d5 | 30 | pubnub_last_result() is available in all Pubnub client libraries, |
sveljko | 0:243e0d70a1d5 | 31 | pubnub_await() is not. |
sveljko | 0:243e0d70a1d5 | 32 | */ |
sveljko | 0:243e0d70a1d5 | 33 | |
sveljko | 0:243e0d70a1d5 | 34 | |
sveljko | 0:243e0d70a1d5 | 35 | /** Waits, in a loop, for the current transaction to finish. */ |
sveljko | 0:243e0d70a1d5 | 36 | enum pubnub_res pubnub_await(pubnub_t *p); |
sveljko | 0:243e0d70a1d5 | 37 | |
sveljko | 0:243e0d70a1d5 | 38 | |
sveljko | 0:243e0d70a1d5 | 39 | #endif /* defined INC_PUBNUB_NTF_CONTIKI */ |