// Use the PCF macro to wrap strings stored in FLASH on the Arduino
// Example: OC_LOG(INFO, TAG, PCF("Entering function"));
#ifdef ARDUINO
- #define PCF(str) ((const prog_char*)(F(str)))
+ #define PCF(str) ((PROGMEM const char *)(F(str)))
#else
#define PCF(str) str
#endif
* @param tag - Module name
* @param logStr - log string
*/
- void OCLog(LogLevel level, const prog_char * tag, const prog_char * logStr);
+ void OCLog(LogLevel level, PROGMEM const char * tag, PROGMEM const char * logStr);
/**
* Output the contents of the specified buffer (in hex) with the specified priority level.
* @param buffer - pointer to buffer of bytes
* @param bufferSize - max number of byte in buffer
*/
- void OCLogBuffer(LogLevel level, const prog_char * tag, const uint8_t * buffer, uint16_t bufferSize);
+ void OCLogBuffer(LogLevel level, PROGMEM const char * tag, const uint8_t * buffer, uint16_t bufferSize);
/**
* Output a variable argument list log string with the specified priority level.
#elif defined ARDUINO
#include <stdarg.h>
- prog_char level0[] PROGMEM = "DEBUG";
- prog_char level1[] PROGMEM = "INFO";
- prog_char level2[] PROGMEM = "WARNING";
- prog_char level3[] PROGMEM = "ERROR";
- prog_char level4[] PROGMEM = "FATAL";
+ PROGMEM char level0[] = "DEBUG";
+ PROGMEM char level1[] = "INFO";
+ PROGMEM char level2[] = "WARNING";
+ PROGMEM char level3[] = "ERROR";
+ PROGMEM char level4[] = "FATAL";
- PROGMEM const prog_char * LEVEL[] = {level0, level1, level2, level3, level4};
+ PROGMEM const char * LEVEL[] = {level0, level1, level2, level3, level4};
- static void OCLogString(LogLevel level, const prog_char * tag, const char * logStr);
+ static void OCLogString(LogLevel level, PROGMEM const char * tag, PROGMEM const char * logStr);
#endif
* @param tag - Module name
* @param logStr - log string
*/
- void OCLogString(LogLevel level, const prog_char * tag, const char * logStr) {
+ void OCLogString(LogLevel level, PROGMEM const char * tag, const char * logStr) {
#ifdef TB_LOG
if (!logStr || !tag) {
return;
* @param buffer - pointer to buffer of bytes
* @param bufferSize - max number of byte in buffer
*/
- void OCLogBuffer(LogLevel level, const prog_char * tag, const uint8_t * buffer, uint16_t bufferSize) {
+ void OCLogBuffer(LogLevel level, PROGMEM const char * tag, const uint8_t * buffer, uint16_t bufferSize) {
#ifdef TB_LOG
if (!buffer || !tag || (bufferSize == 0)) {
return;
* @param tag - Module name
* @param logStr - log string
*/
- void OCLog(LogLevel level, const prog_char * tag, const prog_char * logStr) {
+ void OCLog(LogLevel level, PROGMEM const char * tag, PROGMEM const char * logStr) {
#ifdef TB_LOG
if (!logStr || !tag) {
return;
* @param tag - Module name
* @param format - variadic log string
*/
- void OCLogv(LogLevel level, const prog_char * tag, const char *format, ...)
+ void OCLogv(LogLevel level, PROGMEM const char * tag, const char * format, ...)
{
#ifdef TB_LOG
char buffer[LINE_BUFFER_SIZE];
* @param tag - Module name
* @param format - variadic log string
*/
- void OCLogv(LogLevel level, const prog_char * tag, const __FlashStringHelper *format, ...)
+ void OCLogv(LogLevel level, PROGMEM const char * tag, const __FlashStringHelper *format, ...)
{
#ifdef TB_LOG
char buffer[LINE_BUFFER_SIZE];
#include "ArduinoLoggerTest.h"
#include "logger.h"
-const prog_char tag[] PROGMEM = "Arduino";
-const prog_char msg[] PROGMEM = "Arduino Logger Test";
+PROGMEM const char tag[] = "Arduino";
+PROGMEM const char msg[] = "Arduino Logger Test";
-const prog_char debugMsg[] PROGMEM = "this is a DEBUG message";
-const prog_char infoMsg[] PROGMEM = "this is a INFO message";
-const prog_char warningMsg[] PROGMEM = "this is a WARNING message";
-const prog_char errorMsg[] PROGMEM = "this is a ERROR message";
-const prog_char fatalMsg[] PROGMEM = "this is a FATAL message";
+PROGMEM const char debugMsg[] = "this is a DEBUG message";
+PROGMEM const char infoMsg[] = "this is a INFO message";
+PROGMEM const char warningMsg[] = "this is a WARNING message";
+PROGMEM const char errorMsg[] = "this is a ERROR message";
+PROGMEM const char fatalMsg[] = "this is a FATAL message";
-const prog_char multiLineMsg[] PROGMEM = "this is a DEBUG message\non multiple\nlines";
+PROGMEM const char multiLineMsg[] = "this is a DEBUG message\non multiple\nlines";
//-----------------------------------------------------------------------------
#include <logger.h>
/// Ensures the literal string to be stored in Flash memory
-#define PCF(str) ((const prog_char*)(F(str)))
+#define PCF(str) ((PROGMEM const char *)(F(str)))
/// Module Name
#define MOD_NAME PCF("ocsocket")
};
unsigned int TEST_BUF_LEN = sizeof(TEST_BUF);
-#define PCF(str) ((const prog_char*)(F(str)))
+#define PCF(str) ((PROGMEM const char *)(F(str)))
#define MOD_NAME PCF("ocsocket_test")
const char *getResult(OCStackResult result);
-#define PCF(str) ((const prog_char*)(F(str)))
+#define PCF(str) ((PROGMEM const char *)(F(str)))
-const prog_char TAG[] PROGMEM = "ArduinoServer";
+PROGMEM const char TAG[] = "ArduinoServer";
int gQuitFlag = 0;
int gLEDUnderObservation = 0;
#include "ocstackinternal.h"
#include <string.h>
-#define PCF(str) ((const prog_char*)(F(str)))
+#define PCF(str) ((PROGMEM const char *)(F(str)))
-const prog_char TAG[] PROGMEM = "Arduino";
+PROGMEM const char TAG[] = "Arduino";
static OCUri SERVICE_URI = "coap://127.0.0.1:5683/";
#if 0 // Turn off logger test stuff
-const prog_char tag[] PROGMEM = "Arduino";
-const prog_char msg[] PROGMEM = "Arduino Logger Test";
+PROGMEM const char tag[] = "Arduino";
+PROGMEM const char msg[] = "Arduino Logger Test";
-const prog_char debugMsg[] PROGMEM = "this is a DEBUG message";
-const prog_char infoMsg[] PROGMEM = "this is a INFO message";
-const prog_char warningMsg[] PROGMEM = "this is a WARNING message";
-const prog_char errorMsg[] PROGMEM = "this is a ERROR message";
-const prog_char fatalMsg[] PROGMEM = "this is a FATAL message";
+PROGMEM const char debugMsg[] = "this is a DEBUG message";
+PROGMEM const char infoMsg[] = "this is a INFO message";
+PROGMEM const char warningMsg[] = "this is a WARNING message";
+PROGMEM const char errorMsg[] = "this is a ERROR message";
+PROGMEM const char fatalMsg[] = "this is a FATAL message";
-const prog_char multiLineMsg[] PROGMEM = "this is a DEBUG message\non multiple\nlines";
+PROGMEM const char multiLineMsg[] = "this is a DEBUG message\non multiple\nlines";
#endif
void EXPECT_EQ(int a, int b) {