targets_disallow_multitransport = ['arduino']
help_vars = Variables()
+
+help_vars.Add('PROJECT_VERSION', 'The version of IoTivity', project_version)
+
help_vars.Add(BoolVariable('VERBOSE', 'Show compilation', False))
help_vars.Add(BoolVariable('RELEASE', 'Build for release?', True)) # set to 'no', 'false' or 0 for debug
help_vars.Add(EnumVariable('TARGET_OS', 'Target platform', host, host_target_map[host]))
import platform
Import('env')
+PROJECT_VERSION = env.get('PROJECT_VERSION')
+
TARGET_ARCH = env.get('TARGET_ARCH')
if env.get('RELEASE'):
RELEASE="release"
SConscript('jni/SConscript')
jdk_env = Environment(ENV=os.environ)
-jdk_env['BUILDERS']['Gradle'] = Builder(action = env.get('ANDROID_GRADLE') + ' build -b ' + env.get('SRC_DIR') + '/java/iotivity-%s/build.gradle -PWITH_TRANSPORT_EDR=%s -PWITH_TRANSPORT_BLE=%s -PWITH_TRANSPORT_NFC=%s -PTARGET_ARCH=%s -PRELEASE=%s -PSECURED=%s -DSECURE=%s -PWITH_CLOUD=%s -PRD_MODE=%s -PWITH_MQ_PUB=%s -PWITH_MQ_SUB=%s -PWITH_MQ_BROKER=%s -PWITH_TCP=%s -PMULTIPLE_OWNER=%s -PBUILD_DIR=%s --stacktrace' %(target_os, TRANSPORT_EDR, TRANSPORT_BLE, TRANSPORT_NFC, TARGET_ARCH, RELEASE, SECURED, SECURED, CLOUD, RD_MODE, MQ_PUB, MQ_SUB, MQ_BROKER, TCP, ANDROID_MULTIPLE_OWNER, env.get('BUILD_DIR')), emitter = ensure_libs)
+jdk_env['BUILDERS']['Gradle'] = Builder(action = env.get('ANDROID_GRADLE') + ' build -b ' + env.get('SRC_DIR') + '/java/iotivity-%s/build.gradle -PPROJECT_VERSION=%s -PWITH_TRANSPORT_EDR=%s -PWITH_TRANSPORT_BLE=%s -PWITH_TRANSPORT_NFC=%s -PTARGET_ARCH=%s -PRELEASE=%s -PSECURED=%s -DSECURE=%s -PWITH_CLOUD=%s -PRD_MODE=%s -PWITH_MQ_PUB=%s -PWITH_MQ_SUB=%s -PWITH_MQ_BROKER=%s -PWITH_TCP=%s -PMULTIPLE_OWNER=%s -PBUILD_DIR=%s --stacktrace' %(target_os, PROJECT_VERSION, TRANSPORT_EDR, TRANSPORT_BLE, TRANSPORT_NFC, TARGET_ARCH, RELEASE, SECURED, SECURED, CLOUD, RD_MODE, MQ_PUB, MQ_SUB, MQ_BROKER, TCP, ANDROID_MULTIPLE_OWNER, env.get('BUILD_DIR')), emitter = ensure_libs)
jdk_env['BUILD_DIR'] = env.get('BUILD_DIR')
cmdBuildApi=jdk_env.Gradle(target="base/objs", source="common/src/main/java/org/iotivity/base/OcResource.java")
examples_target = "java"
if target_os == 'android':
examples_target = "android"
-jdk_env['BUILDERS']['Gradle'] = Builder(action = env.get('ANDROID_GRADLE') + ' build -b ' + 'java/examples-%s/build.gradle -DWITH_TRANSPORT_EDR=%s -DWITH_TRANSPORT_BLE=%s -DWITH_TRANSPORT_NFC=%s -PTARGET_OS=%s -PTARGET_ARCH=%s -PRELEASE=%s -PSECURED=%s -DSECURE=%s -PWITH_CLOUD=%s -PRD_MODE=%s -PWITH_MQ_PUB=%s -PWITH_MQ_SUB=%s -PWITH_MQ_BROKER=%s -PWITH_TCP=%s -PMULTIPLE_OWNER=%s -PBUILD_DIR=%s --stacktrace' %(examples_target, TRANSPORT_EDR, TRANSPORT_BLE, TRANSPORT_NFC, target_os, TARGET_ARCH, RELEASE, SECURED, SECURED, CLOUD, RD_MODE, MQ_PUB, MQ_SUB, MQ_BROKER, TCP, ANDROID_MULTIPLE_OWNER, env.get('BUILD_DIR')))
+jdk_env['BUILDERS']['Gradle'] = Builder(action = env.get('ANDROID_GRADLE') + ' build -b ' + 'java/examples-%s/build.gradle -PPROJECT_VERSION=%s -DWITH_TRANSPORT_EDR=%s -DWITH_TRANSPORT_BLE=%s -DWITH_TRANSPORT_NFC=%s -PTARGET_OS=%s -PTARGET_ARCH=%s -PRELEASE=%s -PSECURED=%s -DSECURE=%s -PWITH_CLOUD=%s -PRD_MODE=%s -PWITH_MQ_PUB=%s -PWITH_MQ_SUB=%s -PWITH_MQ_BROKER=%s -PWITH_TCP=%s -PMULTIPLE_OWNER=%s -PBUILD_DIR=%s --stacktrace' %(examples_target, PROJECT_VERSION, TRANSPORT_EDR, TRANSPORT_BLE, TRANSPORT_NFC, target_os, TARGET_ARCH, RELEASE, SECURED, SECURED, CLOUD, RD_MODE, MQ_PUB, MQ_SUB, MQ_BROKER, TCP, ANDROID_MULTIPLE_OWNER, env.get('BUILD_DIR')))
#cmdBuildExamples=jdk_env.Gradle(target="../examples-%s/devicediscoveryclient/apk" % (examples_target, ), source="examples-%s/devicediscoveryclient/src/main/java/org/iotivity/base/examples/DeviceDiscoveryClient.java" % (examples_target, ))
cmdBuildExamples=jdk_env.Gradle(target="examples-%s/simpleclient/jar" % (examples_target, ), source="examples-%s/simpleclient/src/main/java/org/iotivity/base/examples/SimpleClient.java" % (examples_target, ))
minSdkVersion 21\r
targetSdkVersion 21\r
versionCode 1\r
- versionName "1.3.0"\r
+ versionName PROJECT_VERSION\r
buildConfigField 'int', 'SECURED', SECURED\r
buildConfigField 'int', 'WITH_TCP', WITH_TCP\r
buildConfigField 'int', 'WITH_CLOUD', WITH_CLOUD\r
* Method to set DeviceId.
*/
public static native void setDeviceId(byte[] deviceId) throws OcException;
+
+ /**
+ * Method to get the version of IoTivity.
+ */
+ public static native String getIoTivityVersion();
}
* Method to set DeviceId.
*/
public static native void setDeviceId(byte[] deviceId) throws OcException;
+
+ /**
+ * Method to get the version of IoTivity.
+ */
+ public static native String getIoTivityVersion();
}
ThrowOcException(e.code(), e.reason().c_str());
}
}
+
+/*
+* Class: org_iotivity_base_OcPlatform
+* Method: getIoTivityVersion
+* Signature: ()Ljava/lang/String;
+*/
+JNIEXPORT jstring JNICALL Java_org_iotivity_base_OcPlatform_getIoTivityVersion(
+ JNIEnv *env, jclass thiz)
+{
+ LOGI("OcPlatform_getIoTivityVersion");
+ return env->NewStringUTF(IOTIVITY_VERSION);
+}
* Method: setDeviceId
* Signature: (Ljava/lang/byte;)V
*/
- JNIEXPORT void JNICALL Java_org_iotivity_base_OcPlatform_setDeviceId(
- JNIEnv *, jobject, jbyteArray);
+ JNIEXPORT void JNICALL Java_org_iotivity_base_OcPlatform_setDeviceId
+ (JNIEnv *, jobject, jbyteArray);
+
+ /*
+ * Class: org_iotivity_base_OcPlatform
+ * Method: getIoTivityVersion
+ * Signature: ()Ljava/lang/String;
+ */
+ JNIEXPORT jstring JNICALL Java_org_iotivity_base_OcPlatform_getIoTivityVersion
+ (JNIEnv *, jclass);
#ifdef __cplusplus
}
CAResult_t CAInitialize(CATransportAdapter_t transportType)
{
- OIC_LOG_V(DEBUG, TAG, "IoTivity version is v%s", IOTIVITY_VERSION);
OIC_LOG_V(DEBUG, TAG, "CAInitialize type : %d", transportType);
if (!g_isInitialized)
// Defines
//-----------------------------------------------------------------------------
+/** Version of IoTivity. */
+#define IOTIVITY_VERSION "1.3.0"
+
/**
* OIC Virtual resources supported by every OIC device.
*/
#ifndef LOGGER_H_
#define LOGGER_H_
-#define IOTIVITY_VERSION "1.3.0"
-
#include <inttypes.h>
#include <stdint.h>
#include <stdio.h>
return OCInit2(mode, serverFlags, clientFlags, OC_DEFAULT_ADAPTER);
}
-OCStackResult OCInit2(OCMode mode, OCTransportFlags serverFlags,
- OCTransportFlags clientFlags, OCTransportAdapter transportType)
+OCStackResult OCInit2(OCMode mode, OCTransportFlags serverFlags, OCTransportFlags clientFlags,
+ OCTransportAdapter transportType)
{
OIC_LOG(INFO, TAG, "Entering OCInit2");
// This is the first call to initialize the stack so it gets to do the real work.
result = OCInitializeInternal(mode, serverFlags, clientFlags, transportType);
}
-
+
if (result == OC_STACK_OK)
{
// Increment the start count since we're about to return success.
}
OCStackResult OCInitializeInternal(OCMode mode, OCTransportFlags serverFlags,
- OCTransportFlags clientFlags, OCTransportAdapter transportType)
+ OCTransportFlags clientFlags, OCTransportAdapter transportType)
{
if (stackState == OC_STACK_INITIALIZED)
{
}
#endif
+ OIC_LOG_V(INFO, TAG, "IoTivity version is v%s", IOTIVITY_VERSION);
OCStackResult result = OC_STACK_ERROR;
// Validate mode
} \
}
-#define VERSION "1.3.0"
+#define VERSION IOTIVITY_VERSION
#define NS_ATTRIBUTE_VERSION "x.org.iotivity.ns.version"
#define NS_ATTRIBUTE_POLICY "x.org.iotivity.ns.subcontrollability"