publish final code

Dependencies:   FXOS8700CQ Pubnub_mbed2_sync2 SoftSerial TinyGPSplus WNCInterface2 mbed-rtos mbed

Committer:
cswiger
Date:
Tue Feb 21 22:28:26 2017 +0000
Revision:
0:1092494506a3
publish final code

Who changed what in which revision?

UserRevisionLine numberNew contents of line
cswiger 0:1092494506a3 1 /* -*- c-file-style:"stroustrup"; indent-tabs-mode: nil -*- */
cswiger 0:1092494506a3 2 #if !defined INC_PUBNUB_CONFIG
cswiger 0:1092494506a3 3 #define INC_PUBNUB_CONFIG
cswiger 0:1092494506a3 4
cswiger 0:1092494506a3 5
cswiger 0:1092494506a3 6 /* -- Next few definitions can be tweaked by the user, but with care -- */
cswiger 0:1092494506a3 7
cswiger 0:1092494506a3 8 /** Maximum number of PubNub contexts. It is used only if the
cswiger 0:1092494506a3 9 * contexts are statically allocated.
cswiger 0:1092494506a3 10 * A context is used to publish messages or subscribe to (get) them.
cswiger 0:1092494506a3 11 *
cswiger 0:1092494506a3 12 * Doesn't make much sense to have less than 1. :)
cswiger 0:1092494506a3 13 * OTOH, don't put too many, as each context takes (for our purposes)
cswiger 0:1092494506a3 14 * a significant amount of memory - app. 128 + @ref PUBNUB_BUF_MAXLEN +
cswiger 0:1092494506a3 15 * @ref PUBNUB_REPLY_MAXLEN bytes.
cswiger 0:1092494506a3 16 *
cswiger 0:1092494506a3 17 * A typical configuration may consist of a single pubnub context for
cswiger 0:1092494506a3 18 * channel subscription and another pubnub context that will periodically
cswiger 0:1092494506a3 19 * publish messages about device status (with timeout lower than message
cswiger 0:1092494506a3 20 * generation frequency).
cswiger 0:1092494506a3 21 *
cswiger 0:1092494506a3 22 * Another typical setup may have a single subscription context and
cswiger 0:1092494506a3 23 * maintain a pool of contexts for each publish call triggered by an
cswiger 0:1092494506a3 24 * external event (e.g. a button push).
cswiger 0:1092494506a3 25 *
cswiger 0:1092494506a3 26 * Of course, there is nothing wrong with having just one context, but
cswiger 0:1092494506a3 27 * you can't publish and subscribe at the same time on the same context.
cswiger 0:1092494506a3 28 * This isn't as bad as it sounds, but may be a source of headaches
cswiger 0:1092494506a3 29 * (lost messages, etc).
cswiger 0:1092494506a3 30 */
cswiger 0:1092494506a3 31 #define PUBNUB_CTX_MAX 2
cswiger 0:1092494506a3 32
cswiger 0:1092494506a3 33 /** Maximum length of the HTTP buffer. This is a major component of
cswiger 0:1092494506a3 34 * the memory size of the whole pubnub context, but it is also an
cswiger 0:1092494506a3 35 * upper bound on URL-encoded form of published message, so if you
cswiger 0:1092494506a3 36 * need to construct big messages, you may need to raise this. */
cswiger 0:1092494506a3 37 #define PUBNUB_BUF_MAXLEN 32000
cswiger 0:1092494506a3 38
cswiger 0:1092494506a3 39 /** Set to 0 to use a static buffer and then set its size via
cswiger 0:1092494506a3 40 #PUBNUB_REPLY_MAXLEN. Set to anything !=0 to use a dynamic
cswiger 0:1092494506a3 41 buffer, that is, dynamically try to allocate as much memory as
cswiger 0:1092494506a3 42 needed for the buffer.
cswiger 0:1092494506a3 43 */
cswiger 0:1092494506a3 44 #define PUBNUB_DYNAMIC_REPLY_BUFFER 1
cswiger 0:1092494506a3 45
cswiger 0:1092494506a3 46 #if !PUBNUB_DYNAMIC_REPLY_BUFFER
cswiger 0:1092494506a3 47
cswiger 0:1092494506a3 48 /** Maximum length of the HTTP reply when using a static buffer. The
cswiger 0:1092494506a3 49 * other major component of the memory size of the PubNub context,
cswiger 0:1092494506a3 50 * beside #PUBNUB_BUF_MAXLEN. Replies of API calls longer than this
cswiger 0:1092494506a3 51 * will be discarded and an error will be reported. Specifically, this
cswiger 0:1092494506a3 52 * may cause lost messages returned by subscribe if too many too large
cswiger 0:1092494506a3 53 * messages got queued on the Pubnub server. */
cswiger 0:1092494506a3 54 #define PUBNUB_REPLY_MAXLEN 32000
cswiger 0:1092494506a3 55
cswiger 0:1092494506a3 56 #endif
cswiger 0:1092494506a3 57
cswiger 0:1092494506a3 58 /** This is the URL of the Pubnub server. Change only for testing
cswiger 0:1092494506a3 59 purposes.
cswiger 0:1092494506a3 60 */
cswiger 0:1092494506a3 61 #define PUBNUB_ORIGIN "pubsub.pubnub.com"
cswiger 0:1092494506a3 62
cswiger 0:1092494506a3 63 /** Set to 0 to disable changing the origin from the default
cswiger 0:1092494506a3 64 #PUBNUB_ORIGIN. Set to anything != 0 to enable changing the
cswiger 0:1092494506a3 65 origin (per context).
cswiger 0:1092494506a3 66 */
cswiger 0:1092494506a3 67 #define PUBNUB_ORIGIN_SETTABLE 1
cswiger 0:1092494506a3 68
cswiger 0:1092494506a3 69 /** Duration of the transaction timeout set during context initialization,
cswiger 0:1092494506a3 70 in milliseconds. Can be changed later by the user.
cswiger 0:1092494506a3 71 */
cswiger 0:1092494506a3 72 #define PUBNUB_DEFAULT_TRANSACTION_TIMER 310000
cswiger 0:1092494506a3 73
cswiger 0:1092494506a3 74 #define PUBNUB_HAVE_MD5 0
cswiger 0:1092494506a3 75 #define PUBNUB_HAVE_SHA1 0
cswiger 0:1092494506a3 76
cswiger 0:1092494506a3 77
cswiger 0:1092494506a3 78 /** The size of the stack (in kilobytes) for the "polling" thread, when using
cswiger 0:1092494506a3 79 the callback interface. We don't need much, so, if you want to conserve
cswiger 0:1092494506a3 80 memory, you can try small values. It's hard to say what is the minumum,
cswiger 0:1092494506a3 81 as it depends on the OS functions we call, but, you probably
cswiger 0:1092494506a3 82 shouldn't try less than 64 KB.
cswiger 0:1092494506a3 83
cswiger 0:1092494506a3 84 Set to `0` to use the default stack size.
cswiger 0:1092494506a3 85 */
cswiger 0:1092494506a3 86 #define PUBNUB_CALLBACK_THREAD_STACK_SIZE_KB 0
cswiger 0:1092494506a3 87
cswiger 0:1092494506a3 88
cswiger 0:1092494506a3 89 /** If true (!=0), enable support for (HTTP/S) proxy */
cswiger 0:1092494506a3 90 #define PUBNUB_PROXY_API 0
cswiger 0:1092494506a3 91
cswiger 0:1092494506a3 92 /** The maximum length (in characters) of the host name of the proxy
cswiger 0:1092494506a3 93 that will be saved in the Pubnub context.
cswiger 0:1092494506a3 94 */
cswiger 0:1092494506a3 95 #define PUBNUB_MAX_PROXY_HOSTNAME_LENGTH 63
cswiger 0:1092494506a3 96
cswiger 0:1092494506a3 97 /** If true (!=0), enable support for message encryption/decryption */
cswiger 0:1092494506a3 98 #define PUBNUB_CRYPTO_API 0
cswiger 0:1092494506a3 99
cswiger 0:1092494506a3 100
cswiger 0:1092494506a3 101 #include <MODSERIAL.h>
cswiger 0:1092494506a3 102 extern MODSERIAL pc;
cswiger 0:1092494506a3 103 #define PUBNUB_LOG_PRINTF(...) pc.printf(__VA_ARGS__)
cswiger 0:1092494506a3 104
cswiger 0:1092494506a3 105
cswiger 0:1092494506a3 106 #endif /* !defined INC_PUBNUB_CONFIG */