command in this directory)
Install external libraries:
- $ sudo apt-get install libboost-dev libboost-program-options-dev libexpat1-dev libboost-thread-dev uuid-dev libssl-dev
+ $ sudo apt-get install libboost-dev libboost-program-options-dev libexpat1-dev libboost-thread-dev uuid-dev libssl-dev libtool
Build release binaries:
$ scons
- (Note: C sdk requires tiny-cbor. Please follow the instruction in the build
- message to install tiny-cbor)
+ (Note: C sdk requires tinycbor. Please follow the instruction in the build
+ message to install tinycbor)
Build debug binaries:
$scons RELEASE=false
guide you to do that.)
Tizen:
- To build for tizen platform tiny-cbor library is needed.
- Please download tiny-cbor if it is not present in extlibs/tiny-cbor folder
+ To build for tizen platform tinycbor library is needed.
+ Please download tinycbor if it is not present in extlibs/tinycbor folder
by doing the following:
$ git clone https://github.com/01org/tinycbor.git extlibs/tinycbor/tinycbor
1. Build IoTivity project for Linux
$ cd <top directory of the project>
- $ sudo apt-get install libboost-dev libexpat1-dev libboost-thread-dev libssl-dev
+ $ sudo apt-get install libboost-dev libexpat1-dev libboost-thread-dev libssl-dev libtool
$ scons
2. Build IoTivity project for Android
help_vars.Add(BoolVariable('WITH_RA', 'Build with Remote Access module', False))
+help_vars.Add(BoolVariable('WITH_RA_IBB', 'Build with Remote Access module(workssys)', False))
if target_os in targets_disallow_multitransport:
help_vars.Add(ListVariable('TARGET_TRANSPORT', 'Target transport', 'IP', ['BT', 'BLE', 'IP']))
i_n = ienv.Install(env.get('BUILD_DIR'), targets)
ienv.Alias("install", i_n)
+ def __installheader(ienv, targets, dir, name):
+ user_prefix = env.get('PREFIX')
+ if user_prefix:
+ i_n = ienv.Install(user_prefix + '/include/' + dir ,targets)
+ else:
+ i_n = ienv.Install(env.get('BUILD_DIR'), targets)
+ ienv.Alias("install", i_n)
+
def __append_target(ienv, name, targets = None):
if targets:
env.Alias(name, targets)
env.AddMethod(__install, 'InstallTarget')
env.AddMethod(__installlib, 'UserInstallTargetLib')
env.AddMethod(__installbin, 'UserInstallTargetBin')
+ env.AddMethod(__installheader, 'UserInstallTargetHeader')
env.SetDir(env.GetLaunchDir())
env['ROOT_DIR']=env.GetLaunchDir()+'/..'
target_os = env.get('TARGET_OS')
with_ra = env.get('WITH_RA')
+with_ra_ibb = env.get('WITH_RA_IBB')
# As in the source code, it includes arduino Time library (C++)
# It requires compile the .c with g++
if target_os == 'arduino':
if target_os in ['android', 'linux', 'tizen']:
liboctbstack_env.PrependUnique(LIBS = ['connectivity_abstraction'])
- if with_ra:
- liboctbstack_env.AppendUnique(LIBS = ['ra_xmpp'])
-
+ if with_ra_ibb:
+ liboctbstack_env.AppendUnique(LIBS = liboctbstack_env['RALIBS'], LIBPATH = liboctbstack_env['RALIBPATH'], RPATH = liboctbstack_env['RARPATH'])
+ else :
+ if with_ra:
+ liboctbstack_env.AppendUnique(LIBS = ['ra_xmpp'])
liboctbstack_env.AppendUnique(LIBS = ['coap', 'm'])
if target_os == 'tizen':
static_liboctbstack = liboctbstack_env.StaticLibrary('octbstack', liboctbstack_src)
liboctbstack_env.InstallTarget(static_liboctbstack, 'liboctbstack')
liboctbstack_env.UserInstallTargetLib(static_liboctbstack, 'liboctbstack')
+ liboctbstack_env.UserInstallTargetHeader('stack/include/ocstackconfig.h', 'resource', 'ocstackconfig.h')
+ liboctbstack_env.UserInstallTargetHeader('stack/include/octypes.h', 'resource', 'octypes.h')
else:
static_liboctbstack = liboctbstack_env.StaticLibrary('octbstack', liboctbstack_src)
shared_liboctbstack = liboctbstack_env.SharedLibrary('octbstack', liboctbstack_src)
liboctbstack_env.InstallTarget([static_liboctbstack, shared_liboctbstack], 'liboctbstack')
liboctbstack_env.UserInstallTargetLib([static_liboctbstack, shared_liboctbstack], 'liboctbstack')
+ liboctbstack_env.UserInstallTargetHeader('stack/include/ocstackconfig.h', 'resource', 'ocstackconfig.h')
+ liboctbstack_env.UserInstallTargetHeader('stack/include/octypes.h', 'resource', 'octypes.h')
+ liboctbstack_env.UserInstallTargetHeader('stack/include/ocstack.h', 'resource', 'ocstack.h')
#include "ocstack.h"
#include "logger.h"
#include "ocpayload.h"
+ #include "payload_logging.h"
#include "ocremoteaccessclient.h"
// Tracking user input
OC_LOG_V(INFO, TAG, "StackResult: %s", getResult(clientResponse->result));
OC_LOG_V(INFO, TAG, "SEQUENCE NUMBER: %d", clientResponse->sequenceNumber);
- OC_LOG_PAYLOAD(INFO, TAG, clientResponse->payload);
+ OC_LOG_PAYLOAD(INFO, clientResponse->payload);
if(clientResponse->numRcvdVendorSpecificHeaderOptions > 0)
{
OC_LOG_V(INFO, TAG, "StackResult: %s", getResult(clientResponse->result));
OC_LOG_V(INFO, TAG, "SEQUENCE NUMBER: %d", clientResponse->sequenceNumber);
OC_LOG_V(INFO, TAG, "OBSERVE notification %d recvd", gNumObserveNotifies);
- OC_LOG_PAYLOAD(INFO, TAG, clientResponse->payload);
+ OC_LOG_PAYLOAD(INFO, clientResponse->payload);
gNumObserveNotifies++;
if (gNumObserveNotifies == maxNotification)
OC_LOG_V(INFO, TAG, "StackResult: %s", getResult(clientResponse->result));
OC_LOG_V(INFO, TAG, "NONCE NUMBER: %u", clientResponse->sequenceNumber);
OC_LOG_V(INFO, TAG, "PRESENCE notification %d recvd", gNumPresenceNotifies);
- OC_LOG_PAYLOAD(INFO, TAG, clientResponse->payload);
+ OC_LOG_PAYLOAD(INFO, clientResponse->payload);
gNumPresenceNotifies++;
if (gNumPresenceNotifies == maxNotification)
}
OC_LOG_V(INFO, TAG, "StackResult: %s", getResult(clientResponse->result));
- OC_LOG_PAYLOAD(INFO, TAG, clientResponse->payload);
+ OC_LOG_PAYLOAD(INFO, clientResponse->payload);
responseAddr = clientResponse->devAddr;
if(clientResponse)
{
- OC_LOG_PAYLOAD(INFO, TAG, clientResponse->payload);
+ OC_LOG_PAYLOAD(INFO, clientResponse->payload);
}
else
{
if(clientResponse)
{
- OC_LOG_PAYLOAD(INFO, TAG, clientResponse->payload);
+ OC_LOG_PAYLOAD(INFO, clientResponse->payload);
}
else
{
return ret;
}
-OCStackResult initRemoteAccessAdapter ()
-{
- OCRAInfo_t rainfo;
- rainfo.hostname = "localhost";
- rainfo.port = 5222;
- rainfo.xmpp_domain = "localhost";
- rainfo.username = "test1";
- rainfo.password = "intel123";
- rainfo.resource = "";
- rainfo.user_jid = "";
-
- return OCSetRAInfo(&rainfo);
-}
-
int main(int argc, char* argv[])
{
- int opt;
+ OCRAInfo_t rainfo = {.hostname = "localhost", .port = 5222,
+ .xmpp_domain = "localhost", .username = "test1", .password = "intel123",
+ .resource = "", .user_jid = ""};
- while ((opt = getopt(argc, argv, "t:")) != -1)
+ int opt = 0;
+ while ((opt = getopt(argc, argv, "t:s:p:d:u:w:r:j:")) != -1)
{
switch(opt)
{
case 't':
TEST_CASE = atoi(optarg);
break;
+ case 's':
+ rainfo.hostname = optarg;
+ break;
+ case 'p':
+ rainfo.port = atoi(optarg);
+ break;
+ case 'd':
+ rainfo.xmpp_domain = optarg;
+ break;
+ case 'u':
+ rainfo.username = optarg;
+ break;
+ case 'w':
+ rainfo.password = optarg;
+ break;
+ case 'j':
+ rainfo.user_jid = optarg;
+ break;
+ case 'r':
+ rainfo.resource = optarg;
+ break;
default:
PrintUsage();
return -1;
}
}
- if (initRemoteAccessAdapter() != OC_STACK_OK)
+ if (OCSetRAInfo(&rainfo) != OC_STACK_OK)
{
OC_LOG(ERROR, TAG, "Error initiating remote access adapter");
return 0;
return ehResult;
}
- OCEntityHandlerResult ProcessNonExistingResourceRequest(OCEntityHandlerRequest *ehRequest)
+ OCEntityHandlerResult ProcessNonExistingResourceRequest(OCEntityHandlerRequest * /*ehRequest*/)
{
OC_LOG_V(INFO, TAG, "\n\nExecuting %s ", __func__);
OCEntityHandlerResult
OCDeviceEntityHandlerCb (OCEntityHandlerFlag flag,
- OCEntityHandlerRequest *entityHandlerRequest, char* uri, void* callbackParam)
+ OCEntityHandlerRequest *entityHandlerRequest,
+ char* uri,
+ void* /*callbackParam*/)
{
OC_LOG_V (INFO, TAG, "Inside device default entity handler - flags: 0x%x, uri: %s", flag, uri);
}
OCEntityHandlerResult
- OCNOPEntityHandlerCb (OCEntityHandlerFlag flag,
- OCEntityHandlerRequest *entityHandlerRequest, void* callbackParam)
+ OCNOPEntityHandlerCb (OCEntityHandlerFlag /*flag*/,
+ OCEntityHandlerRequest * /*entityHandlerRequest*/,
+ void* /*callbackParam*/)
{
// This is callback is associated with the 2 presence notification
// resources. They are non-operational.
OCEntityHandlerResult
OCEntityHandlerCb (OCEntityHandlerFlag flag,
- OCEntityHandlerRequest *entityHandlerRequest, void* callback)
+ OCEntityHandlerRequest *entityHandlerRequest, void* /*callback*/)
{
OC_LOG_V (INFO, TAG, "Inside entity handler - flags: 0x%x", flag);
OCEntityHandlerResult ehResult = OC_EH_OK;
- OCEntityHandlerResponse response = { 0 };
+ OCEntityHandlerResponse response = { 0, 0, OC_EH_ERROR, 0, 0, { },{ 0 }, false };
// Validate pointer
if (!entityHandlerRequest)
{
pthread_t threadId;
pthread_t threadId_presence;
- int opt;
- while ((opt = getopt(argc, argv, "o:")) != -1)
+#ifdef RA_ADAPTER
+ OCRAInfo_t rainfo = {.hostname = "localhost", .port = 5222,
+ .xmpp_domain = "localhost", .username = "test1", .password = "intel123",
+ .resource = "", .user_jid = ""};
+#endif
+
+ int opt = 0;
+ while ((opt = getopt(argc, argv, "o:s:p:d:u:w:r:j:")) != -1)
{
switch(opt)
{
case 'o':
gObserveNotifyType = atoi(optarg);
break;
+#ifdef RA_ADAPTER
+ case 's':
+ rainfo.hostname = optarg;
+ break;
+ case 'p':
+ rainfo.port = atoi(optarg);
+ break;
+ case 'd':
+ rainfo.xmpp_domain = optarg;
+ break;
+ case 'u':
+ rainfo.username = optarg;
+ break;
+ case 'w':
+ rainfo.password = optarg;
+ break;
+ case 'j':
+ rainfo.user_jid = optarg;
+ break;
+ case 'r':
+ rainfo.resource = optarg;
+ break;
+#endif
default:
PrintUsage();
return -1;
PrintUsage();
return -1;
}
+
#ifdef RA_ADAPTER
+ OCRAInfo_t rainfo;
+ rainfo.hostname = "localhost";
+ rainfo.port = 5222;
+ rainfo.xmpp_domain = "localhost";
+ rainfo.username = "test1";
+ rainfo.password = "intel123";
+ rainfo.resource = "";
+ rainfo.user_jid = "";
+
OCSetRAInfo(&rainfo);
#endif