IoTivity includes a series of projects. You can find all these projects here:
https://gerrit.iotivity.org/gerrit/#/admin/projects/
-You can build IoTivity project on Linux / Windows / MAC OSX for various OS(
-Linux, Tizen, Android, Arduino, Windows, MAC OSX, IOS ...).
+You can build IoTivity project on Linux / Windows / MAC OSX for various targets
+(Linux, Tizen, Android, Windows, MAC OSX, iOS ...).
The output of the build is in:
<top directory of the project>/out/<target_os>/<target_arch>/<build_type>/
e.g.
(Note: on Windows, install Python 2.x before installing scons)
* 2. IDE/SDK Prerequites
-To build for some OS (Android / Arduino / IOS ...), an IDE/SDK may be required,
+To build for some OS (Android / iOS ...), an IDE/SDK may be required,
please go to the relative page to download and install the required IDE/SDK.
Android:
(Note: as in some IoTivity projects, C++11 features are used, recommend Android
NDK >= r10)
-Arduino:
-To build for Arduino, Arduino IDE is required.
- Arduino IDE: http://arduino.cc/en/Main/Software
- (Note: recommend install Arduino IDE >=1.5.8)
-
-Arduino builds are dependent on latest Time library. Download it from here:
- http://www.pjrc.com/teensy/td_libs_Time.html
-and extract to <arduino_ide_root>/libraries/
-
-(Note: If you are using Arduino IDE 1.5.8 BETA on Windows, it may pop up some
-dll isn't found. please copy relative dll from the IDE directory to
-C:\Windows\SysWOW64. IDE 1.5.7 doesn't have this issue. Other version IDE isn't
-tested.)
-
Apple:
To build for Mac OSX or IOS, Xcode is required.
Xcode: https://developer.apple.com/xcode/downloads/
wiki to setup Tizen development environment:
https://source.tizen.org/documentation/developer-guide/getting-started-guide)
-Arduino:
- * Possible values for <TARGET_TRANSPORT> are: IP, BLE
- * Possible values for <TARGET_ARCH> are: arv, arm
- (arv: arduino due, arm: arduino mega)
- * Possible values for <BOARD> are: arduino_due_x_dbg, arduino_due_x, mega
- * Possible values for <SHIELD> are: ETH, WIFI
- (It is required in the case of the arduino due.)
-
- 1. Go to root directory
- $ cd <top directory of the project>
- $ sudo apt-get install dos2unix
-
- 2. Execute following command(s) to start build based on transport selection required
-
- -> Building for a specific transport :
- $ scons TARGET_OS=arduino TARGET_ARCH=xxx BOARD=yyy SHIELD=zzz
-
-(To get allowed values run: scons TARGET_OS=arduino TARGET_ARCH=xxx SHIELD=zzz -h.
-You may see a option 'CPU' in the output of above command line, that's due to
-some boards have different processors, to specify the processor, add 'CPU=zzz'
-in the command line. If no 'CPU' option exists, that means the board only
-support one kind of processor, it's unnecessary to specify it)
-
Mac OSX:
* Possible values for <SYS_VERSION> are: OSX version, e.g. 10.9
* TEST=1 or 0 (Run unit tests)
* BUILD_SAMPLE=ON or OFF (Build with sample)
* ROUTING=GW or EP (Enable routing)
- * WITH_TCP=true or false (Enable CoAP over TCP Transport, arduino is not supported)
+ * WITH_TCP=true or false (Enable CoAP over TCP Transport)
* RD_MODE=CLIENT or SERVER (Build including Resource Directory)
* SIMULATOR=true or false (Build with simulator module)
* Possible values for <WITH_MQ> are: PUB,SUB,BROKER (Build including Message Queue)
==== UB Stack & TB Stack - Artifact Output Locations ====
===============================================================================
+WARNING: TODO: this file is out of date
+
This file contains the file location for every artifact from every possible
build process in the OIC-RESOURCE repository.
<oic-resource>/examples/ocicuc/monoprocess
<oic-resource>/examples/ocicuc/server
-
-===============================================================================
-==== Arduino ATMega 2560 - Release & Debug - Ethernet Shield ====
-===============================================================================
-
-TB Stack:
- Ethernet Shield:
- release:
- <oic-resource>/csdk/arduinomega/ethernet_shield/release/liboctbstack.a
- debug:
- <oic-resource>/csdk/arduinomega/ethernet_shield/debug/liboctbstack.a
-
-TB Examples:
- Ethernet Shield:
- release:
- <oic-resource>/csdk/stack/samples/arduino/SimpleClientServer/ocserver/arduinomega/ethernet_shield/release/ocserver.hex
- debug:
- <oic-resource>/csdk/stack/samples/arduino/SimpleClientServer/ocserver/arduinomega/ethernet_shield/debug/ocserver.hex
-
-===============================================================================
-==== Arduino ATMega 2560 - Release & Debug - WiFi Shield ====
-===============================================================================
-
-TB Stack:
- WiFi Shield:
- release:
- <oic-resource>/csdk/arduinomega/wifi_shield/release/liboctbstack.a
- debug:
- <oic-resource>/csdk/arduinomega/wifi_shield/debug/liboctbstack.a
-
-TB Examples:
- WiFi Shield:
- release:
- <oic-resource>/csdk/stack/samples/arduino/SimpleClientServer/ocserver/arduinomega/wifi_shield/release/ocserver.hex
- debug:
- <oic-resource>/csdk/stack/samples/arduino/SimpleClientServer/ocserver/arduinomega/wifi_shield/debug/ocserver.hex
-
-===============================================================================
-==== Arduino Due - Release & Debug - Ethernet Shield ====
-===============================================================================
-
-TB Stack:
- Ethernet Shield:
- release:
- <oic-resource>/csdk/arduinodue/ethernet_shield/release/liboctbstack.a
- debug:
- <oic-resource>/csdk/arduinodue/ethernet_shield/debug/liboctbstack.a
-
-TB Examples:
- Ethernet Shield:
- release:
- <oic-resource>/csdk/stack/samples/arduino/SimpleClientServer/ocserver/arduinodue/ethernet_shield/release/ocserver.hex
- debug:
- <oic-resource>/csdk/stack/samples/arduino/SimpleClientServer/ocserver/arduinodue/ethernet_shield/debug/ocserver.hex
-
-===============================================================================
-==== Arduino Due - Release & Debug - WiFi Shield ====
-===============================================================================
-
-TB Stack:
- WiFi Shield:
- release:
- <oic-resource>/csdk/arduinodue/wifi_shield/release/liboctbstack.a
- debug:
- <oic-resource>/csdk/arduinodue/wifi_shield/debug/liboctbstack.a
-
-TB Examples:
- WiFi Shield:
- release:
- <oic-resource>/csdk/stack/samples/arduino/SimpleClientServer/ocserver/arduinodue/wifi_shield/release/ocserver.hex
- debug:
- <oic-resource>/csdk/stack/samples/arduino/SimpleClientServer/ocserver/arduinodue/wifi_shield/debug/ocserver.hex
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#ifdef __cplusplus
extern "C" {
-#endif
-
-#ifdef ARDUINO
-// MEGA has 16 input pins whereas Due has only 12 input pins
-#define ANALOG_IN (10)
#endif
/* Number of bytes in a UUID. */
*/
#define OCRANDOM_TAG "OIC_OCRANDOM"
-#ifdef ARDUINO
-#include "Arduino.h"
-
-/*
- * ARM GCC compiler doesnt define random/srandom functions, fallback to
- * rand/srand.
- */
-#if !defined(ARDUINO_ARCH_SAM)
-#define OC_arduino_srandom_function srandom
-#define OC_arduino_random_function random
-#else
-#define OC_arduino_srandom_function srand
-#define OC_arduino_random_function rand
-#endif
-
-uint8_t GetRandomBitRaw()
-{
- return analogRead((uint8_t)ANALOG_IN) & 0x1;
-}
-
-uint8_t GetRandomBitRaw2()
-{
- int a = 0;
- for (;;)
- {
- a = GetRandomBitRaw() | (GetRandomBitRaw()<<1);
- if (a==1)
- {
- return 0; // 1 to 0 transition: log a zero bit
- }
- if (a==2)
- {
- return 1;// 0 to 1 transition: log a one bit
- }
- // For other cases, try again.
- }
-}
-
-uint8_t GetRandomBit()
-{
- int a = 0;
- for (;;)
- {
- a = GetRandomBitRaw2() | (GetRandomBitRaw2()<<1);
- if (a==1)
- {
- return 0; // 1 to 0 transition: log a zero bit
- }
- if (a==2)
- {
- return 1;// 0 to 1 transition: log a one bit
- }
- // For other cases, try again.
- }
-}
-
-/*
- * Currently, only the Arduino platform requires seeding. It's done
- * automatically on the first call to OCGetRandomBytes.
- */
-uint8_t g_isSeeded = 0;
-static void OCSeedRandom()
-{
- if (g_isSeeded)
- {
- return;
- }
-
- uint32_t result =0;
- uint8_t i;
- for (i=32; i--;)
- {
- result += result + GetRandomBit();
- }
- OC_arduino_srandom_function(result);
-
- g_isSeeded = 1;
- return;
-}
-
-#endif /* ARDUINO */
-
bool OCGetRandomBytes(uint8_t * output, size_t len)
{
if ( (output == NULL) || (len == 0) )
return false;
}
-#elif defined(ARDUINO)
- if (!g_isSeeded)
- {
- OCSeedRandom();
- }
-
- size_t i;
- for (i = 0; i < len; i++)
- {
- output[i] = OC_arduino_random_function() & 0x00ff;
- }
-
#else
#error Unrecognized platform
#endif
#include <time.h>
#elif defined(HAVE_SYS_TIME_H)
#include <sys/time.h>
-#elif defined(HAVE_ARDUINO_TIME_H)
-#include <Time.h>
#endif
#ifdef __cplusplus
#include <math.h>
-#ifndef WITH_ARDUINO
#define SECS_PER_MIN (60L)
#define SECS_PER_HOUR (SECS_PER_MIN * 60L)
#define SECS_PER_DAY (SECS_PER_HOUR * 24L)
#define SECS_PER_WEEK (SECS_PER_DAY * DAYS_PER_WEEK)
#define SECS_PER_YEAR (SECS_PER_WEEK * 52L)
#define SECS_YR_2000 (946684800L)
-#endif
typedef void(*TimerCallback)(void *ctx);
void checkTimeout(void);
-#ifndef WITH_ARDUINO
long int getSeconds(struct tm *tp);
time_t getRelativeIntervalOfWeek(struct tm *tp);
time_t getSecondsFromAbsTime(struct tm *tp);
time_t OC_CALL registerTimer(const time_t seconds, int *id, TimerCallback cb, void *ctx);
void OC_CALL unregisterTimer(int id);
-#else
-
-time_t timeToSecondsFromNow(tmElements_t *t);
-time_t OC_CALL registerTimer(const time_t seconds, int *id, TimerCallback cb, void *ctx);
-void OC_CALL unregisterTimer(int id);
-
-#endif
#ifdef __cplusplus
}
#define TIMEOUT_USED 1
#define TIMEOUT_UNUSED 2
-#ifndef WITH_ARDUINO
pthread_t thread_id = 0; // 0: initial thread id (meaningless)
-#endif
struct timelist_t
{
}
}
-#ifndef WITH_ARDUINO
-
long int getSeconds(struct tm *tp)
{
long int nInterval = 0;
return 0;
}
-#else // WITH_ARDUINO
-time_t timeToSecondsFromNow(tmElements_t *t_then)
-{
- time_t t, then;
-
- t = now();
- then = makeTime((*t_then));
-
- return (time_t) (then - t);
-}
-
-time_t OC_CALL registerTimer(const time_t seconds, int *id, TimerCallback cb, void *ctx)
-{
- time_t t, then;
- time_t next;
- int i, idx;
-
- if (seconds <= 0)
- return -1;
-
- // get the current time
- t = now();
-
- for (idx = 0; idx < TIMEOUTS; ++idx)
- if (!((timeout_list[idx].timeout_state & TIMEOUT_USED) & TIMEOUT_USED))
- break;
-
- if (TIMEOUTS == idx)// reach to end of timer list
- return -1;
-
- // idx th timeout will be used.
- // Reset and set state of the timer
- timeout_list[idx].timeout_state = 0;
- timeout_list[idx].timeout_state |= TIMEOUT_USED;
-
- // calculate when the timeout should fire
- then = t;
- timespec_add(&then, seconds);
-
- timeout_list[idx].timeout_time = then;
- timeout_list[idx].timeout_seconds = seconds;
- timeout_list[idx].ctx = ctx;
-
- // printf( "\nbefore timeout_list[idx].cb = %X\n", timeout_list[idx].cb);
- timeout_list[idx].cb = cb;
- // printf( " after timeout_list[idx].cb = %X\n", timeout_list[idx].cb);
-
- // How long till the next timeout?
- next = seconds;
- for (i = 0; i < TIMEOUTS; i++)
- {
- if ((timeout_list[i].timeout_state & (TIMEOUT_USED | TIMEOUT_UNUSED))
- == TIMEOUT_USED)
- {
- const time_t secs = timespec_diff(timeout_list[i].timeout_time,
- t);
-
- if (secs >= 0 && secs < next)
- next = secs;
- }
- }
-
- *id = idx;
- /* Return the timeout number. */
- return timeout_list[idx].timeout_time;
-}
-
-void OC_CALL unregisterTimer(int idx)
-{
- if (0 <= idx && idx < TIMEOUTS)
- timeout_list[idx].timeout_state = TIMEOUT_UNUSED;
-}
-
-void checkTimeout()
-{
- time_t t;
- int i;
-
- t = now();
-
- /* Check all timeouts that are used and armed, but not passed yet. */
- for (i = 0; i < TIMEOUTS; i++)
- {
- if ((timeout_list[i].timeout_state & (TIMEOUT_USED | TIMEOUT_UNUSED))
- == TIMEOUT_USED)
- {
- const time_t seconds = timespec_diff(timeout_list[i].timeout_time,
- t);
-
- if (seconds <= 0)
- {
- /* timeout [i] fires! */
- timeout_list[i].timeout_state = TIMEOUT_UNUSED;
- if (timeout_list[i].cb)
- {
- timeout_list[i].cb(timeout_list[i].ctx);
- }
- }
- }
- }
-}
-
-#endif
* the time returned will be `precision` time units since the epoch,
* without adjustment for any external changes to the clock.
*
- * For Arduino, returns the time since the Arduino board begin
- * running this program.
- *
* @param precision based on this parameter, current time is
* returned in milliseconds or microseconds
*
* @warning This function may be sensitive to system time changes on
* platforms which do not support a monotonic clock.
*
- * @note
- * On the Arduino platform,
- * if the time precision is in milliseconds then the function will
- * overflow (go back to 0) after approximately 50 days.
- * If the time precision is in microseconds then the function will
- * overflow (go back to 0) after approximately 70 minutes.
- *
* @return
* Returns current time in milliseconds or microseconds.
*/
#if defined(HAVE_WINDOWS_H)
# include <windows.h>
# define HAVE_QUERYPERFORMANCEFREQUENCY
-#elif !defined(WITH_ARDUINO)
+#else
# if _POSIX_TIMERS > 0
# include <time.h> // For clock_gettime()
# else
{
uint64_t currentTime = 0;
-#ifdef WITH_ARDUINO
- currentTime = (TIME_IN_MS == precision) ? millis() : micros();
-#elif defined(HAVE_QUERYPERFORMANCEFREQUENCY)
+#if defined(HAVE_QUERYPERFORMANCEFREQUENCY)
static LARGE_INTEGER frequency = {0};
if (!frequency.QuadPart)
: (((uint64_t) current.tv_sec * US_PER_SEC) + (current.tv_usec));
}
# endif // _POSIX_TIMERS > 0
-#endif // WITH_ARDUINO
+#endif // HAVE_QUERYPERFORMANCEFREQUENCY
return currentTime;
}
# define SIZE_MAX ((size_t)-1)
#endif
-#ifdef WITH_ARDUINO
-/**
- * UINT16_MAX does not appear to be defined on Arduino so we define it here.
- */
-# define UINT16_MAX 65535
-
-/**
- * Handle case that PRId64 is not defined in Arduino's inttypes.h
- */
-# if !defined(PRId64)
-# define PRId64 "lld"
-# endif
-#endif
-
/**
* Calling convention.
*/
+++ /dev/null
-#Source directories
-SDIR_ARD_CORE_1 = $(ARDUINO_DIR)/hardware/arduino/sam/cores/arduino
-SDIR_ARD_CORE_2 = $(ARDUINO_DIR)/hardware/arduino/sam/cores/arduino/USB
-SDIR_ARD_CORE_3 = $(ARDUINO_DIR)/hardware/arduino/sam/variants/arduino_due_x
-SDIR_ARD_CORE_4 = $(ARDUINO_DIR)/hardware/arduino/sam/cores/arduino/avr
-SDIR_ARD_SPI = $(ARDUINO_DIR)/hardware/arduino/sam/libraries/SPI
-SDIR_ARD_ETH = $(ARDUINO_DIR)/libraries/Ethernet/src
-SDIR_ARD_ETH_UTIL = $(ARDUINO_DIR)/libraries/Ethernet/src/utility
-SDIR_ARD_WIFI = $(ARDUINO_DIR)/libraries/WiFi/src
-SDIR_ARD_WIFI_UTIL = $(ARDUINO_DIR)/libraries/WiFi/src/utility
-SDIR_ARD_TIME = $(ARDUINO_DIR)/libraries/Time/Time
-
-SDIR_ARD_PLATFORM = $(SDIR_ARD_CORE_1):$(SDIR_ARD_CORE_2):$(SDIR_ARD_CORE_3):$(SDIR_ARD_CORE_4):$(SDIR_ARD_SPI):\
- $(SDIR_ARD_TIME)
-
-#include directories
-IDIR_ARD_CORE_1 = $(ARDUINO_DIR)/hardware/arduino/sam/cores/arduino
-IDIR_ARD_CORE_2 = $(ARDUINO_DIR)/hardware/arduino/sam/system/libsam
-IDIR_ARD_CORE_3 = $(ARDUINO_DIR)/hardware/arduino/sam/system/CMSIS/CMSIS/Include
-IDIR_ARD_CORE_4 = $(ARDUINO_DIR)/hardware/arduino/sam/system/CMSIS/Device/ATMEL
-IDIR_ARD_CORE_5 = $(ARDUINO_DIR)/hardware/arduino/sam/variants/arduino_due_x
-IDIR_ARD_SPI = $(ARDUINO_DIR)/hardware/arduino/sam/libraries/SPI
-IDIR_ARD_ETH = $(ARDUINO_DIR)/libraries/Ethernet/src
-IDIR_ARD_ETH_UTIL = $(ARDUINO_DIR)/libraries/Ethernet/src/utility
-INCD_ARD_WIFI = $(ARDUINO_DIR)/libraries/WiFi/src
-INCD_ARD_WIFI_UTIL = $(ARDUINO_DIR)/libraries/WiFi/src/utility
-INCD_ARD_TIME = $(ARDUINO_DIR)/libraries/Time/Time
-
-
-INC_DIR_PLATFORM = -I$(IDIR_ARD_CORE_1) -I$(IDIR_ARD_CORE_2) -I$(IDIR_ARD_CORE_3) -I$(IDIR_ARD_CORE_4) -I$(IDIR_ARD_CORE_5) \
- -I$(IDIR_ARD_SPI) -I$(INCD_ARD_TIME)
-
-#Compiler/Linker flags
-CFLAGS_PLATFORM = -ffunction-sections -fdata-sections -nostdlib --param max-inline-insns-single=500 -fno-rtti -fno-exceptions \
- -Dprintf=iprintf -mcpu=cortex-m3 -DF_CPU=84000000L -DARDUINO=157 -DARDUINO_SAM_DUE -DARDUINO_ARCH_SAM \
- -D__SAM3X8E__ -mthumb -DUSB_VID=0x2341 -DUSB_PID=0x003e -DUSBCON -DUSB_MANUFACTURER="Unknown" \
- -DWITH_ARDUINO -DNDEBUG
-
-#Compilers
-CXX=$(ARDUINO_TOOLS_DIR)/arm-none-eabi-g++
-CC=$(ARDUINO_TOOLS_DIR)/arm-none-eabi-gcc
-AR=$(ARDUINO_TOOLS_DIR)/arm-none-eabi-ar
-RANLIB=$(ARDUINO_TOOLS_DIR)/arm-none-eabi-ranlib
-AVR_PROGRAMMER=$(ARDUINO_TOOLS_DIR)/bossac
-
-#Needed object files
-CORE_COBJ = hooks.o dtostrf.o iar_calls_sam3.o WInterrupts.o wiring.o wiring_digital.o wiring_analog.o wiring_shift.o\
- wiring_pulse.o USARTClass.o USBCore.o RingBuffer.o cortex_handlers.o
-CORE_CPPOBJ = itoa.o main.o Stream.o WMath.o WString.o Print.o IPAddress.o HID.o UARTClass.o CDC.o Reset.o cxxabi-compat.o
-ETH_CPPOBJ = Dhcp.o Dns.o Ethernet.o EthernetUdp.o EthernetClient.o
-ETH_UTIL_CPPOBJ = socket.o w5100.o
-WIFI_COBJ = WiFi.o WiFiClient.o WiFiServer.o WiFiUdp.o server_drv.o spi_drv.o wifi_drv.o
-VARIANT_OBJ = variant.o
-SPI_OBJ = SPI.o
-SYSCALLS_SAM3_OBJ = syscalls_sam3.o
-
-PLATFORM_OBJS = $(SYSCALLS_SAM3_OBJ) $(SPI_OBJ) $(VARIANT_OBJ) $(CORE_COBJ) $(CORE_CPPOBJ)
-
-#Include sources/objects corresponding to WiFi or Ethernet shield
-ifeq ($(ARDUINOWIFI),1)
- INC_DIR_PLATFORM += -I$(INCD_ARD_WIFI) -I$(INCD_ARD_WIFI_UTIL)
- SDIR_ARD_PLATFORM += :$(SDIR_ARD_WIFI):$(SDIR_ARD_WIFI_UTIL)
- PLATFORM_OBJS += $(WIFI_COBJ)
-else
- INC_DIR_PLATFORM += -I$(IDIR_ARD_ETH) -I$(IDIR_ARD_ETH_UTIL)
- SDIR_ARD_PLATFORM += :$(SDIR_ARD_ETH):$(SDIR_ARD_ETH_UTIL)
- PLATFORM_OBJS += $(ETH_CPPOBJ) $(ETH_UTIL_CPPOBJ)
-endif
-
-
+++ /dev/null
-
-#Source directories
-SDIR_ARD_CORE = $(ARDUINO_DIR)/hardware/arduino/avr/cores/arduino
-SDIR_ARD_SPI = $(ARDUINO_DIR)/hardware/arduino/avr/libraries/SPI
-SDIR_ARD_ETH = $(ARDUINO_DIR)/libraries/Ethernet/src
-SDIR_ARD_ETH_UTIL = $(ARDUINO_DIR)/libraries/Ethernet/src/utility
-SDIR_ARD_WIFI = $(ARDUINO_DIR)/libraries/WiFi/src
-SDIR_ARD_WIFI_UTIL = $(ARDUINO_DIR)/libraries/WiFi/src/utility
-SDIR_ARD_TIME = $(ARDUINO_DIR)/libraries/Time/Time
-SDIR_ARD_PLATFORM = $(SDIR_ARD_CORE):$(SDIR_ARD_SPI):$(SDIR_ARD_TIME)
-
-#include directories
-INCD_ARD_CORE = -I$(ARDUINO_DIR)/hardware/arduino/avr/cores/arduino
-INCD_ARD_VARIANT = -I$(ARDUINO_DIR)/hardware/arduino/avr/variants/mega
-INCD_ARD_SPI = -I$(ARDUINO_DIR)/hardware/arduino/avr/libraries/SPI
-INCD_ARD_ETH = -I$(ARDUINO_DIR)/libraries/Ethernet/src
-INCD_ARD_ETH_UTIL = -I$(ARDUINO_DIR)/libraries/Ethernet/src/utility
-INCD_ARD_WIFI = -I$(ARDUINO_DIR)/libraries/WiFi/src
-INCD_ARD_WIFI_UTIL = -I$(ARDUINO_DIR)/libraries/WiFi/src/utility
-INCD_ARD_TIME = -I$(ARDUINO_DIR)/libraries/Time/Time
-
-INC_DIR_PLATFORM = $(INCD_ARD_CORE) $(INCD_ARD_VARIANT) $(INCD_ARD_SPI) $(INCD_ARD_TIME)
-
-#Compiler/Linker flags
-CFLAGS_PLATFORM = -mmcu=atmega2560 -DF_CPU=16000000L -DARDUINO=156 -DARDUINO_AVR_MEGA2560 -DARDUINO_ARCH_AVR -DWITH_ARDUINO \
- -MMD -std=c++0x -Wno-write-strings -ffunction-sections -fdata-sections -fno-exceptions -felide-constructors -DATMEGA2560 -DNDEBUG
-
-#Compilers
-CXX=$(ARDUINO_TOOLS_DIR)/avr-g++
-CC=$(ARDUINO_TOOLS_DIR)/avr-gcc
-AR=$(ARDUINO_TOOLS_DIR)/avr-ar
-RANLIB=$(ARDUINO_TOOLS_DIR)/avr-ranlib
-AVR_OBJCOPY=$(ARDUINO_TOOLS_DIR)/avr-objcopy
-AVR_PROGRAMMER=$(ARDUINO_TOOLS_DIR)/avrdude
-
-#Needed object files
-CORE_COBJ = hooks.o WInterrupts.o wiring.o wiring_digital.o wiring_analog.o wiring_shift.o wiring_pulse.o
-CORE_CPPOBJ = CDC.o HardwareSerial.o HardwareSerial0.o HardwareSerial1.o HardwareSerial2.o HardwareSerial3.o IPAddress.o HID.o \
- main.o new.o Print.o Stream.o Tone.o USBCore.o WMath.o WString.o SPI.o
-ETH_CPPOBJ = Dhcp.o Dns.o Ethernet.o EthernetUdp.o
-ETH_UTIL_CPPOBJ = socket.o w5100.o
-WIFI_COBJ = WiFi.o WiFiClient.o WiFiServer.o WiFiUdp.o server_drv.o spi_drv.o wifi_drv.o
-OCDEPENDENT_CPPOBJ = wiring_analog.o
-
-PLATFORM_OBJS = $(CORE_COBJ) $(CORE_CPPOBJ) $(OCDEPENDENT_CPPOBJ)
-
-#Include sources/objects corresponding to WiFi or Ethernet shield
-ifeq ($(ARDUINOWIFI),1)
- INC_DIR_PLATFORM += $(INCD_ARD_WIFI) $(INCD_ARD_WIFI_UTIL)
- SDIR_ARD_PLATFORM += :$(SDIR_ARD_WIFI):$(SDIR_ARD_WIFI_UTIL)
- PLATFORM_OBJS += $(WIFI_COBJ)
-else
- INC_DIR_PLATFORM += $(INCD_ARD_ETH) $(INCD_ARD_ETH_UTIL)
- SDIR_ARD_PLATFORM += :$(SDIR_ARD_ETH):$(SDIR_ARD_ETH_UTIL)
- PLATFORM_OBJS += $(ETH_CPPOBJ) $(ETH_UTIL_CPPOBJ)
-endif
-
/**
* Max header options data length.
*/
-#ifdef ARDUINO
-#define CA_MAX_HEADER_OPTION_DATA_LENGTH 20
-#else
#define CA_MAX_HEADER_OPTION_DATA_LENGTH 1024
-#endif
/**
* Max token length.
/**
* Max URI length.
*/
-#ifdef ARDUINO
-#define CA_MAX_URI_LENGTH 128 /* maximum size of URI for embedded platforms*/
-#else
-#define CA_MAX_URI_LENGTH 512 /* maximum size of URI for other platforms*/
-#endif
+#define CA_MAX_URI_LENGTH 512 /* maximum size of URI */
/**
* Max PDU length supported.
*/
-#ifdef ARDUINO
-#define COAP_MAX_PDU_SIZE 320 /* maximum size of a CoAP PDU for embedded platforms*/
-#else
-#define COAP_MAX_PDU_SIZE 1400 /* maximum size of a CoAP PDU for big platforms*/
-#endif
+#define COAP_MAX_PDU_SIZE 1400 /* maximum size of a CoAP PDU */
#ifdef WITH_BWT
#define CA_DEFAULT_BLOCK_SIZE CA_BLOCK_SIZE_1024_BYTE
(Note: on Windows, install Python 2.x before installing scons)
* 2. IDE/SDK Pre-requites
-To build for some OS (Android / Arduino / IOS ...), an IDE/SDK may be required,
+To build for some OS (Android / IOS ...), an IDE/SDK may be required,
please go to the relative page to download and install the required IDE/SDK.
Note: Connectivity module building has been changed. We have to build connectivity
Note :- Upon successful execution of above command(s) CA library and sample applications will be
generated at path "~/GBS-ROOT/local/repos/redwood/armv7l/RPMS".
-Arduino Build:
-
-Note :- Currently Mega & Due build is supported.
-
-1) Set up Arduino first before building. Refer to "connectivity\build\arduino\Arduino_Setup_README.txt" file for help.
-
-2) Go to "iotivity/" folder.
-
-3) Execute following command to start build :
-
-For Arduino Mega
- $ scons resource/csdk/connectivity/samples/arduino/ TARGET_OS=arduino TARGET_TRANSPORT=<transport> TARGET_ARCH=avr BOARD=mega ARDUINO_HOME=<path_to_arduino_installation>
-For Arduino Due
- $ scons resource/csdk/connectivity/samples/arduino/ TARGET_OS=arduino TARGET_TRANSPORT=<transport> TARGET_ARCH=arm BOARD=arduino_due_x_dbg ARDUINO_HOME=<path_to_arduino_installation>
- NOTE: BOARD=arduino_due_x_dbg|arduino_due_x. Default is arduino_due_x_dbg.
-
- Possible values for <transport> are:
- -> IP :
- $ scons resource/csdk/connectivity/samples/arduino/ TARGET_OS=arduino TARGET_TRANSPORT=IP TARGET_ARCH=avr BOARD=mega ARDUINO_HOME=<path_to_arduino_installation>
- -> BLE :
- $ scons resource/csdk/connectivity/samples/arduino/ TARGET_OS=arduino TARGET_TRANSPORT=BLE TARGET_ARCH=avr BOARD=mega ARDUINO_HOME=<path_to_arduino_installation>
-
- Note :- Only single transport can be built at a time for Arduino.
-
-4) The above command will build sample also. The "CASample.hex" can be found at "/samples/arduino/"
-
-5) After building sample, script will try to install on "/dev/ttyACM0" port in 'sudo' mode.
- To skip installation, set command line argument 'UPLOAD=false'.
- "scons resource/csdk/connectivity/samples/arduino/ TARGET_OS=arduino TARGET_TRANSPORT=ETHERNET TARGET_ARCH=avr BOARD=mega ARDUINO_HOME=<path_to_arduino_installation> UPLOAD=false"
-
-6) To set BLE Shield Name, include the option DEVICE_NAME during scons build.
-
- -> $ scons resource/csdk/connectivity/samples/arduino/ TARGET_OS=arduino TARGET_TRANSPORT=ETHERNET TARGET_ARCH=avr BOARD=mega ARDUINO_HOME=<path_to_arduino_installation> DEVICE_NAME=OIC
-
- Specified Device name length MUST be less than 10 characters. RBL Library has this limitation.
- By Default DEVICE_NAME=OIC-DEVICE, if device name option is not specified
-
- To change the port number, please modify "port" variable in __upload() function in: "/build/arduino/SConscript".
-
##
# override with `make BUILD=debug`
-# override with `make PLATFORM=arduinomega` or `make PLATFORM=arduinodue`
# default to release build
# default to build for linux
BUILD := debug
*/
void CAClearServerInfoList(u_arraylist_t *serverInfoList);
-#ifndef WITH_ARDUINO
/**
* Convert address from binary to string.
* @param[in] sockAddr IP address info.
* @return CA_STATUS_OK on success, or an appropriate error code on failure.
*/
CAResult_t CAConvertNameToAddr(const char *host, uint16_t port, struct sockaddr_storage *sockaddr);
-#endif /* WITH_ARDUINO */
#ifdef __JAVA__
/**
#endif
#endif
-#ifndef WITH_ARDUINO
/**
* print send state in the adapter.
* @param[in] adapter transport adapter type.
* @return ::CA_STATUS_OK or Appropriate error code.
*/
CAResult_t CAGetIpv6AddrScopeInternal(const char *addr, CATransportFlags_t *scopeLevel);
-#endif
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* CA_ADAPTER_UTILS_H_ */
-
*/
void CAIPSetPacketReceiveCallback(CAIPPacketReceivedCallback callback);
-#ifdef WITH_ARDUINO
-/**
- * Set socket description for sending unicast UDP data.
- * Once the Unicast server is started,
- * the same socket descriptor is used for sending the Unicast UDP data.
- *
- * @param[in] socketFD Socket descriptor used for sending UDP data.
- */
-void CAIPSetUnicastSocket(int socketFD);
-#endif
/**
* Set the port number for sending unicast UDP data.
#define CA_RESPONSE_CLASS(C) (((C) >> 5)*100)
#define CA_RESPONSE_CODE(C) (CA_RESPONSE_CLASS(C) + (C - COAP_RESPONSE_CODE(CA_RESPONSE_CLASS(C))))
-
-// Include files from the arduino platform do not provide these conversions:
-#ifdef ARDUINO
-#define htons(x) ( ((x)<< 8 & 0xFF00) | ((x)>> 8 & 0x00FF) )
-#define ntohs(x) htons(x)
-#else
#define HAVE_TIME_H 1
-#endif
#ifdef WITH_TCP
static const uint8_t PAYLOAD_MARKER = 1;
#define CA_ADAPTER_UTILS_TAG "OIC_CA_ADAP_UTILS"
-#ifdef WITH_ARDUINO
-CAResult_t CAParseIPv4AddressInternal(const char *ipAddrStr, uint8_t *ipAddr,
- size_t ipAddrLen, uint16_t *port)
-{
- if (!ipAddr || !isdigit(ipAddrStr[0]) || !port)
- {
- OIC_LOG(ERROR, CA_ADAPTER_UTILS_TAG, "invalid param");
- return CA_STATUS_INVALID_PARAM;
- }
-
- size_t index = 0;
- uint8_t dotCount = 0;
-
- ipAddr[index] = 0;
- *port = 0;
- while (*ipAddrStr)
- {
- if (isdigit(*ipAddrStr))
- {
- if(index >= ipAddrLen)
- {
- OIC_LOG(ERROR, CA_ADAPTER_UTILS_TAG, "invalid param");
- return CA_STATUS_INVALID_PARAM;
- }
- ipAddr[index] *= 10;
- ipAddr[index] += *ipAddrStr - '0';
- }
- else if (*ipAddrStr == '.')
- {
- index++;
- dotCount++;
- ipAddr[index] = 0;
- }
- else
- {
- break;
- }
- ipAddrStr++;
- }
-
- if (*ipAddrStr == ':')
- {
- ipAddrStr++;
- while (*ipAddrStr)
- {
- if (isdigit(*ipAddrStr))
- {
- *port *= 10;
- *port += *ipAddrStr - '0';
- }
- else
- {
- break;
- }
- ipAddrStr++;
- }
- }
-
- if (dotCount == 3)
- {
- return CA_STATUS_OK;
- }
- return CA_STATUS_FAILED;
-}
-
-#else // not with_arduino
CAResult_t CAConvertAddrToName(const struct sockaddr_storage *sockAddr, socklen_t sockAddrLen,
char *host, uint16_t *port)
{
freeaddrinfo(addrs);
return CA_STATUS_OK;
}
-#endif // WITH_ARDUINO
#ifdef __JAVA__
void CANativeJNISetJavaVM(JavaVM *jvm)
#endif //__ANDROID__
#endif //JAVA__
-#ifndef WITH_ARDUINO
void CALogAdapterStateInfo(CATransportAdapter_t adapter, CANetworkStatus_t state)
{
OIC_LOG(DEBUG, CA_ADAPTER_UTILS_TAG, "CALogAdapterStateInfo");
return CA_STATUS_FAILED;
}
}
-#endif
return CA_STATUS_FAILED;
}
-#ifdef ARDUINO
- // If max retransmission queue is reached, then don't handle new request
- if (CA_MAX_RT_ARRAY_SIZE == u_arraylist_length(g_retransmissionContext.dataList))
- {
- OIC_LOG(ERROR, TAG, "max RT queue size reached!");
- return CA_SEND_FAILED;
- }
-#endif // ARDUINO
-
CAData_t *data = CAPrepareSendData(endpoint, sendMsg, dataType);
if(!data)
{
OIC_LOG(DEBUG, TAG, "CASendErrorInfo OUT");
}
-#ifndef ARDUINO
static void CALogPDUInfo(const CAData_t *data, const coap_pdu_t *pdu)
{
OIC_LOG(DEBUG, TAG, "CALogPDUInfo");
OIC_LOG(DEBUG, ANALYZER_TAG, "=================================================");
OIC_TRACE_END();
}
-#else
-static void CALogPDUInfo(const CAData_t *data, const coap_pdu_t *pdu)
-{
- VERIFY_NON_NULL_VOID(pdu, TAG, "pdu");
- (void)data;
-
- OIC_LOG_V(DEBUG, TAG, "PDU Maker - payload : %s", pdu->data);
- OIC_LOG_V(DEBUG, TAG, "PDU Maker - type : %d", pdu->transport_hdr->udp.type);
- OIC_LOG_V(DEBUG, TAG, "PDU Maker - code : %d", pdu->transport_hdr->udp.code);
- OIC_LOG(DEBUG, TAG, "PDU Maker - token :");
- OIC_LOG_BUFFER(DEBUG, TAG, pdu->transport_hdr->udp.token,
- pdu->transport_hdr->udp.token_length);
-}
-#endif
To enable logging for Android, TB_LOG should be defined in the ./jni/Android.mk file as
LOCAL_CFLAGS := -DTB_LOG
-
-//-------------------------------------------------
-// Arduino
-//-------------------------------------------------
-To enable the logger for Arduino, TB_LOG should be defined in
-Properties|C/C++ Build|Settings|Tool Settings|AVR Compiler|Symbols
-and
-Properties|C/C++ Build|Settings|Tool Settings|AVR C++ Compiler|Symbols
-
-Note: when building for Arduino, force the compiler to use avr-g++ to build logger.c. Or rename logger.c to logger.cpp.
-
-Note: when building for Arduino, several warnings are generated when trying to place strings in
-PROGMEM
-"warning: only initialized variables can be placed into program memory area"
-This appears to be a known gcc bug - https://gcc.gnu.org/bugzilla/show_bug.cgi?id=34734
-
#include <android/log.h>
#elif defined(__TIZEN__)
#include <dlog.h>
-#elif defined(ARDUINO)
-#include <inttypes.h>
-#include "Arduino.h"
-#include "avr/pgmspace.h"
#endif
#ifdef __cplusplus
-#ifndef ARDUINO
#include <cinttypes>
-#endif
extern "C"
{
#else
#include <inttypes.h>
#endif
-// Use the PCF macro to wrap strings stored in FLASH on the Arduino
-// Example: OIC_LOG(INFO, TAG, PCF("Entering function"));
-#ifdef ARDUINO
-#ifdef __cplusplus
-#define PCF(str) ((PROGMEM const char *)(F(str)))
-#else
-#define PCF(str) ((PROGMEM const char *)(PSTR(str)))
-#endif //__cplusplus
-#else
- #define PCF(str) str
-#endif
+#define PCF(str) str
// Max buffer size used in variable argument log function
#define MAX_LOG_V_BUFFER_SIZE (256)
#define OCLog(level,tag,mes) LOG_(LOG_ID_MAIN, ((level) & (~OC_LOG_PRIVATE_DATA)), (tag), mes)
#define OCLogv(level,tag,fmt,args...) LOG_(LOG_ID_MAIN, ((level) & (~OC_LOG_PRIVATE_DATA)),tag,fmt,##args)
-#elif !defined(ARDUINO)
+#else
/**
* Configure logger to use a context that defines a custom logger function
*
void OCLogConfig(oc_log_ctx_t *ctx);
/**
- * Initialize the logger. Optional on Android and Linux. Configures serial port on Arduino
+ * Initialize the logger. Optional on Android and Linux.
*/
void OCLogInit();
* @param bufferSize - max number of byte in buffer
*/
void OCLogBuffer(int level, const char* tag, const uint8_t* buffer, size_t bufferSize);
-#else // For arduino platforms
- /**
- * Initialize the serial logger for Arduino
- * Only defined for Arduino
- */
- void OCLogInit();
-
- /**
- * Output a log string with the specified priority level.
- * Only defined for Arduino. Uses PROGMEM strings
- *
- * @param level - DEBUG, INFO, WARNING, ERROR, FATAL
- * @param tag - Module name
- * @param lineNum- line Number
- * @param logStr - log string
- */
- void OCLog(int level, PROGMEM const char *tag, const int lineNum,
- PROGMEM const char *logStr);
-
- /**
- * Output the contents of the specified buffer (in hex) with the specified priority level.
- *
- * @param level - DEBUG, INFO, WARNING, ERROR, FATAL
- * @param tag - Module name
- * @param buffer - pointer to buffer of bytes
- * @param bufferSize - max number of byte in buffer
- */
- void OCLogBuffer(int level, const char* tag, const uint8_t* buffer, size_t bufferSize);
-
- /**
- * Output a variable argument list log string with the specified priority level.
- *
- * @param level - DEBUG, INFO, WARNING, ERROR, FATAL
- * @param tag - Module name
- * @param lineNum- line Number
- * @param format - variadic log string
- */
- void OCLogv(int level, PROGMEM const char *tag, const int lineNum,
- PROGMEM const char *format, ...)
-#if defined(__GNUC__)
- __attribute__ ((format(printf, 4, 5)))
-#endif
-;
#endif
#ifdef TB_LOG
OCPrintCALogBuffer((level), (tag), (buffer), (bufferSize), (isHeader)); \
} while(0)
-#else // NO __TIZEN__ - These macros are defined for Linux, Android, Win32, and Arduino
+#else // NO __TIZEN__ - These macros are defined for Linux, Android and Win32.
#define OIC_LOG_INIT() OCLogInit()
-#ifdef ARDUINO
-#define OIC_LOG_BUFFER(level, tag, buffer, bufferSize) \
- do { \
- IF_OC_PRINT_LOG_LEVEL((level)) \
- OCLogBuffer((level), PCF(tag), (buffer), (bufferSize)); \
- } while(0)
-
-// Don't define variable argument log function for Arduino
-#define OIC_LOG_V(level, tag, format, ...) \
- do { \
- IF_OC_PRINT_LOG_LEVEL((level)) \
- OCLogv((level), PCF(tag), __LINE__, PCF(format),__VA_ARGS__); \
- } while(0)
-
-#define OIC_LOG_CONFIG(ctx)
-#define OIC_LOG_SHUTDOWN()
-#define OIC_LOG(level, tag, logStr) \
- do { \
- IF_OC_PRINT_LOG_LEVEL((level)) \
- OCLog((level), PCF(tag), __LINE__, PCF(logStr)); \
- } while(0)
-
-#define OIC_LOG_V(level, tag, ...)
-
-#else // NO ARDUINO
#define OIC_LOG_BUFFER(level, tag, buffer, bufferSize) \
do { \
IF_OC_PRINT_LOG_LEVEL((level)) \
OCLogv((level), (tag), __VA_ARGS__); \
} while(0)
-#endif // ARDUINO
#endif // __TIZEN__
#else // TB_LOG
#ifdef OIC_SUPPORT_TIZEN_TRACE
#include <ttrace.h>
#endif
-#elif defined(ARDUINO)
#endif
#ifdef __cplusplus
#define OIC_TRACE_BUFFER(MSG, BUF, SIZ)
#endif
-#elif defined(ARDUINO)
-/* trace macro for Arduino. currently this will call nothing*/
-#define OIC_TRACE_BEGIN(MSG, ...)
-#define OIC_TRACE_END()
-#define OIC_TRACE_MARK(MSG, ...)
-#define OIC_TRACE_BUFFER(MSG, BUF, SIZ)
-
#else
#define OIC_TRACE_BEGIN(MSG, ...)
#define OIC_TRACE_END()
OIC_LOG_V(INFO, TAG, "oic_trace_end: invalid fd: %d", g_trace_marker_hd);
}
}
-
-#elif defined ARDUINO
-/* TODO: Trace api for ARDUINO and others will be implemented */
-#endif //ARDUINO
-
+#endif // #ifdef __ANDROID__
#endif // #ifndef __TIZEN__
clock_gettime(CLOCK_MONOTONIC, &getTs);
currentTime = getTs.tv_sec;
-#elif defined __ARDUINO__
- currentTime = millis() / 1000;
#else
#if _POSIX_TIMERS > 0
struct timespec ts;
#ifndef IOTVT_ICALENDAR_H
#define IOTVT_ICALENDAR_H
-//Not supported on Arduino due lack of absolute time need to implement iCalendar
-#ifndef WITH_ARDUINO
-
#include <stdint.h> // for uint8_t typedef
#include <stdbool.h>
#include <time.h>
#ifdef __cplusplus
}
#endif
-#endif
#endif //IOTVT_ICALENDAR_H
//
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-//Not supported on Arduino due lack of absolute time need to implement iCalendar
-#if !defined(WITH_ARDUINO)
-
#define _XOPEN_SOURCE //Needed by strptime
#include "iotivity_config.h"
#include <string.h>
}
return ret;
}
-#endif
*/
static bool IsAccessWithinValidTime(const OicSecAce_t *ace)
{
-#ifndef WITH_ARDUINO //Period & Recurrence not supported on Arduino due
- //lack of absolute time
if (NULL== ace || NULL == ace->validities)
{
return true;
}
OIC_LOG(ERROR, TAG, "Access request is in invalid time period");
return false;
-
-#else
- return true;
-#endif
}
/**
//
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-#ifdef WITH_ARDUINO
-#define __STDC_LIMIT_MACROS
-#endif
-
#include <stdlib.h>
#include <string.h>
#include <inttypes.h>
/* Is the cache still valid? */
struct tm now;
memset(&now, 0, sizeof(now));
-#ifndef WITH_ARDUINO /* No reliable time on Arduino, so assume the cache is valid if present. */
time_t nowTimeT = 0;
nowTimeT = time(NULL);
/* If we failed to get the current time, assume the cache is valid if present. */
}
#endif
}
-#endif /* WITH_ARDUINO */
if (IsBefore(&now, &targetEntry->cacheValidUntil))
{
//
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-//Not supported on Arduino due lack of absolute time need to implement iCalendar
-#ifndef WITH_ARDUINO
-
#include <gtest/gtest.h>
#include "iotvticalendar.h"
#include "experimental/logger.h"
EXPECT_EQ(IOTVTICAL_INVALID_ACCESS, IsRequestWithinValidTime(periodStr, recurStr));
}
-
-#endif
To enable logging for Android, TB_LOG should be defined in the ./jni/Android.mk file as
LOCAL_CFLAGS := -DTB_LOG
-
-//-------------------------------------------------
-// Arduino
-//-------------------------------------------------
-To enable the logger for Arduino, TB_LOG should be defined in
-Properties|C/C++ Build|Settings|Tool Settings|AVR Compiler|Symbols
-and
-Properties|C/C++ Build|Settings|Tool Settings|AVR C++ Compiler|Symbols
-
-Note: when building for Arduino, force the compiler to use avr-g++ to build logger.c. Or rename logger.c to logger.cpp.
-
-Note: when building for Arduino, several warnings are generated when trying to place strings in
-PROGMEM
-"warning: only initialized variables can be placed into program memory area"
-This appears to be a known gcc bug - https://gcc.gnu.org/bugzilla/show_bug.cgi?id=34734
-
* @param qos Desired quality of service of the observation notifications.
*
* @note: The memory for obsIdList and payload is managed by the entity invoking the API.
- * The maximum size of the notification is 1015 bytes for non-Arduino platforms. For Arduino
- * the maximum size is 247 bytes.
+ * The maximum size of the notification is 1015 bytes.
*
* @return ::OC_STACK_OK on success, some other value upon failure.
*/
* Maximum length of the URI supported by client/server while processing
* REST requests/responses.
*/
-#ifdef ARDUINO
-#define MAX_URI_LENGTH (64)
-#else
#define MAX_URI_LENGTH (256)
-#endif
/**
* Maximum length of the query supported by client/server while processing
* REST requests/responses.
*/
-#ifdef ARDUINO
-#define MAX_QUERY_LENGTH (64)
-#else
#define MAX_QUERY_LENGTH (256)
-#endif
-
/**
* Maximum length of the Manufacturer name supported by the server
* Maximum number of vendor specific header options an application can set or receive
* in PDU
*/
-#ifdef ARDUINO
-#define MAX_HEADER_OPTIONS (2)
-#else
#define MAX_HEADER_OPTIONS (50)
-#endif
/**
* Maximum Length of the vendor specific header option
*/
-#ifdef ARDUINO
-#define MAX_HEADER_OPTION_DATA_LENGTH (20)
-#else
#define MAX_HEADER_OPTION_DATA_LENGTH (1024)
-#endif
/**
* Sets the time to live (TTL) for response callback(s).
#ifdef HAVE_SYS_TIME_H
#include <sys/time.h>
#endif
-#ifdef HAVE_ARDUINO_TIME_H
-#include "Time.h"
-#endif
#include "cacommon.h"
#include "cainterface.h"
//
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-#ifdef ARDUINO
-#define __STDC_LIMIT_MACROS
-#endif
-
#include "ocpayloadcbor.h"
#include "platform_features.h"
#include <stdlib.h>
#include "oickeepalive.h"
#endif
-#ifdef HAVE_ARDUINO_TIME_H
-#include "Time.h"
-#endif
#ifdef HAVE_SYS_TIME_H
#include <sys/time.h>
#endif
#define MILLISECONDS_PER_SECOND (1000)
-// handle case that SCNd64 is not defined in arduino's inttypes.h
-#if defined(WITH_ARDUINO) && !defined(SCNd64)
-#define SCNd64 "lld"
-#endif
//-----------------------------------------------------------------------------
// Private internal function prototypes
//-----------------------------------------------------------------------------
* @param payload Discovery payload which has Endpoint information.
* @param ifindex index which indicate network interface.
*/
-#if defined (IP_ADAPTER) && !defined (WITH_ARDUINO)
+#if defined (IP_ADAPTER)
static OCStackResult OCMapZoneIdToLinkLocalEndpoint(OCDiscoveryPayload *payload, uint32_t ifindex);
#endif
break;
}
OC_VERIFY(oc_atomic_decrement(&g_ocStackStartStopThreadCount) >= 0);
-#if !defined(ARDUINO)
// Yield execution to the thread that is holding the lock.
sleep(0);
-#else // ARDUINO
- assert(!"Not expecting initCount to go above 1 on Arduino");
- break;
-#endif // ARDUINO
}
}
return OC_STACK_INVALID_PARAM;
}
-#if defined (IP_ADAPTER) && !defined (WITH_ARDUINO)
+#if defined (IP_ADAPTER)
OCStackResult OCMapZoneIdToLinkLocalEndpoint(OCDiscoveryPayload *payload, uint32_t ifindex)
{
if (!payload)
// Check endpoints has link-local ipv6 address.
// if there is, map zone-id which parsed from ifindex
-#if defined (IP_ADAPTER) && !defined (WITH_ARDUINO)
+#if defined (IP_ADAPTER)
if (PAYLOAD_TYPE_DISCOVERY == response->payload->type)
{
OCDiscoveryPayload *disPayload = (OCDiscoveryPayload*)(response->payload);
&(((OCResource *) presenceResource.handle)->resourceProperties),
OC_ACTIVE, 0);
#endif
-#ifndef WITH_ARDUINO
+
if (result == OC_STACK_OK)
{
result = SRMInitSecureResources();
}
-#endif
if(result == OC_STACK_OK)
{
ScheduledResourceInfo *tmp = NULL;
tmp = head;
-
-#if !defined(WITH_ARDUINO)
time(&t_now);
-#else
- t_now = now();
-#endif
if (tmp)
{
// yyyy-mm-dd hh:mm:ss d
iterToken = (char *) strtok_r(NULL, ACTION_DELIMITER, &iterTokenPtr);
VARIFY_PARAM_NULL(iterToken, result, exit)
-#if !defined(WITH_ARDUINO)
if( 2 != sscanf(iterToken, "%ld %u", &(*set)->timesteps, &(*set)->type) )
{
// If the return value should be 2, the number of items in the argument. Otherwise, it fails.
goto exit;
}
-#endif
OIC_LOG_V(INFO, TAG, "ActionSet Name : %s", (*set)->actionsetName);
- The software should be ported on Tizen v2.3 and higher without change.
- The platform specific portion should be controlled by build configurations.
-@paragraph cao_ddoc_nfr604 NFR.604
-Support on Arduino Mega
-- The software should be ported on Arduino Mega without change.
-- Connectivity function can be supported through the various shields.
-- The platform specific portion should be controlled by build configurations.
-
-@paragraph cao_ddoc_nfr605 NFR.605
-Support on Arduino Due
-- The software should be ported on Arduino Due without change.
-- Connectivity function can be supported through the various shields.
-- The platform specific portion should be controlled by build configurations.
-
-
@subsubsection cao_ddoc_qattr_extensibility Extensibility
@paragraph cao_ddoc_nfr701 NFR.701
- The software should be ported on Tizen v2.3 and higher without change.
- The platform specific portion should be controlled by build configurations.
-@paragraph cao_ddoc_nfr604 NFR.604
-Support on Arduino Mega
-- The software should be ported on Arduino Mega without change.
-- Connectivity function can be supported through the various shields.
-- The platform specific portion should be controlled by build configurations.
-
-@paragraph cao_ddoc_nfr605 NFR.605
-Support on Arduino Due
-- The software should be ported on Arduino Due without change.
-- Connectivity function can be supported through the various shields.
-- The platform specific portion should be controlled by build configurations.
-
@subsubsection cao_ddoc_qattr_extensibility Extensibility
-== How to write IoTivity build script ==
+TODO: WARNING: this file is out of date
+
+== How to write IoTivity build scripts ==
IoTivity projects are built with Scons. Scons is a cross-platform build tool,
it's quite similar to 'make'. 'SConstruct' is the entrance of scons build, it's
In above example, 'target_os' is used. How to get it?
User can build IoTivity project on Linux / Windows / MAC OSX for various
-targets(Linux, Tizen, Android, Arduino, Windows, MAC OSX, IOS ...). Most
+targets (Linux, Tizen, Android, Windows, MAC OSX, iOS ...). Most
platform specific configurations have been done in the common scripts which are in
build_common. The common scripts prepare an environment named 'env' with
target platform specific configuration.
TARGET_OS: the name of the target OS. The possible value depends on the host
platform. Bellow is the list of host and possible target OS. (darwin means
MAC OSX)
- linux: linux / android / arduino / tizen (means on Linux, you can build the
- project for Linux/Android/Arduino/Tizen)
- windows: windows / winrt / android / arduino
- darwin: darwin / ios / android / arduino
+ linux: linux / android / tizen (means on Linux, you can build the
+ project for Linux/Android/Tizen)
+ windows: windows / winrt / android
+ darwin: darwin / ios / android
TARGET_ARCH: the target CPU arch. Its possible value depends on the target OS.
Bellow list the target OS and allowed CPU architecture.
winrt: arm
darwin: i386 / x86_64
ios: i386 / x86_64 / armv7 / armv7s / arm64,
- arduino: avr / arm
=== Extra functions ===
-For convenience, in the common scripts, some extra functions are added.
+For convenience, in the common scripts, some extra functions are added:
PrintTargets(): print all target names in the help information.
AppendTarget(name, target = None): add a target name into targets list, when use
InstallTarget(files, name): it takes the same action as AppendTarget, besides,
it installs the 'files' to BUILD_DIR.
-Following functions are only for Arduino:
-ImportLib(lib): Arduino IDE includes many libraries. By default, no library is
-compiled. If your project use some libraries, you can import the library by
-this function. 'lib' is the name of the library to import. The 'include' path
-will be auto added to the environment and the library will be built and linked
-into the final binary.
-
-CreateBin(bin, src): For Arduino, after build the program, it's required to
-be converted into specific format (e.g .hex). This function will generate the
-required .hex (and .eep if target arch is avr) file from 'bin'.
-
-UploadHelp(): For different board, the upload command line is different, this
-function print the recommended upload command line. You can see the recommended
-upload command line in the help information(the output of command "scons
-[options] -h")
Functions for external library management:
+
PrepareLib(libname, lib = None, path = None, script = None): Check whether a
library exists, if not, notify user to install it or try to download the source
code and build it
#include <iostream>
#include <string>
-#ifndef WITH_ARDUINO
#include <memory>
#include <vector>
-#endif
#include "OCPlatform.h"
#include "ocstack.h"
#define OCF_CONTENT_FORMAT_VERSION_OPTION_ID 2053
#define OCF_CONTENT_FORMAT_VERSION_VALUE 2048
-#ifndef WITH_ARDUINO
namespace OIC
{
namespace Service
}
}
-#endif //WITH_ARDUINO
#endif //ES_COMMON_RICH_H_
in the `iotivity` directory in the vagrant user's home directory.
Optional (currently disabled) features are provisioning for Android
-and Arduino building. Android will now correctly provision on first
-scons run where those build options are selected. Arduino building is
-no longer really supported on iotivity (use iotivity-constrained instead).
+building. Android will now correctly provision on first scons run where
+those build options are selected. Arduino building is no longer supported
+on iotivity (use iotivity-constrained instead).
Also optional, it should be able to configure for Ubuntu 17.04
and 17.10, by changing which of the the stanzas in Vagrantfile is