- JNI compilation issue is happening due to a change in file location and a structure name change.
- Seperated Arduino specific implementation using #ifdef
- Changed file persmission for some of the files from 777 to 644
Change-Id: Id73eac55bb678c9e6bddb288db55e5d8cd4680d1
Signed-off-by: lankamadan <lanka.madan@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/4865
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
help_vars.Add(PathVariable('ANDROID_NDK', 'Android NDK path', None, PathVariable.PathAccept))
help_vars.Add(PathVariable('ANDROID_HOME', 'Android SDK path', None, PathVariable.PathAccept))
help_vars.Add(PathVariable('ANDROID_GRADLE', 'Gradle binary file', None, PathVariable.PathIsFile))
+help_vars.Add(EnumVariable('TARGET_ENROLLEE', 'Target Enrollee', 'arduino', allowed_values=('arduino', 'tizen', 'linux')))
AddOption('--prefix',
dest='prefix',
######################################################################
#building Resource client, resourceBroker and resourceCache
######################################################################
-
if env.get('RELEASE'):
env.AppendUnique(CCFLAGS = ['-Os'])
env.AppendUnique(CPPDEFINES = ['NDEBUG'])
if env.get('LOGGING'):
env.AppendUnique(CPPDEFINES = ['TB_LOG'])
-
+
+# Easysetup provides reference implemenation of Arduino Enrollee.
+# Mediator applications developed on different platforms will be default defining the
+# flag 'REMOTE_ARDUINO_ENROLEE'. If the target Enrollee is not Arduino, the below commented
+# modifications must be enabled instead (and the existing define must be commented).
+#
+##### The following lines must be uncommented, if target Enrollee is not Arduino
+target_enrollee = env.get('TARGET_ENROLLEE')
+if target_enrollee == 'arduino':
+ print "REMOTE_ARDUINO_ENROLEE flag is defined."
+ print "The Mediator application will be working only with Arduino Enrollee."
+ env.AppendUnique(CPPDEFINES = ['REMOTE_ARDUINO_ENROLEE'])
+
# Add third party libraries
lib_env = env.Clone()
SConscript(env.get('SRC_DIR') + '/service/third_party_libs.scons', 'lib_env')
EnrolleeInfo connectedDevice;\r
private EasySetupManager easySetupManagerNativeInstance;\r
ProvisionEnrollee provisionEnrolleInstance;\r
- Timer myTimer;\r
+ Timer myTimer = null;\r
\r
IOnBoardingStatus deviceScanListener = new IOnBoardingStatus() {\r
\r
\r
protected void stopOnBoardingProcess() {\r
Log.i(TAG, "Stopping on boarding process");\r
- myTimer.cancel();\r
+ if(myTimer != null)\r
+ {\r
+ myTimer.cancel();\r
+ }\r
boolean status = mWifiSoftAPManager.setWifiApEnabled(null, false);\r
Log.i(TAG, "Soft AP is disabled with status " + status);\r
}\r
LOCAL_C_INCLUDES := $(LOCAL_PATH) \
$(LOCAL_PATH)/jniutil/inc \
$(LOCAL_PATH)/../../../../../../service/easy-setup/sdk/mediator/inc \
+ $(LOCAL_PATH)/../../../../../../service/easy-setup/sdk/mediator/src \
$(LOCAL_PATH)/../../../../../../service/easy-setup/sdk/common \
$(LOCAL_PATH)/../../../../../../resource/csdk/logger/include \
$(LOCAL_PATH)/../../../../../../resource/csdk/connectivity/common/inc \
LOCAL_SHARED_LIBRARIES += android-connectivity_abstraction
LOCAL_SHARED_LIBRARIES += android-octbstack
-include $(BUILD_SHARED_LIBRARY)
\ No newline at end of file
+include $(BUILD_SHARED_LIBRARY)
LOGI("JNI JNIProvisionEnrollee : netPWD is : %s",netPWD);
OCConnectivityType connecitivityType;
- EnrolleeNWProvInfo_t netInfo =
+ EnrolleeNWProvInfo netInfo =
{ 0};
strncpy(netInfo
.netAddressInfo.WIFI.ipAddress, ipAddress, IPV4_ADDR_SIZE-1);
#include <sstream>
#include "prov_adapter.h"
+#include "oic_string.h"
+
#define ES_PROV_ADAP_TAG "ES_PROVISIONING_ADAPTER"
//Use ipv4addr for both InitDiscovery and InitDeviceDiscovery
char ipv4addr[IPV4_ADDR_SIZE] = {0};
-static const char * UNICAST_PROVISIONING_QUERY = "coap://%s:%d/oic/res?rt=oic.r.prov";
+#ifdef REMOTE_ARDUINO_ENROLEE
+ //Arduino Enrollee needs mediator application provide IP and port55555 which is specific
+ // to Arduino WiFi enrollee
+ static const char * UNICAST_PROVISIONING_QUERY = "coap://%s:%d/oic/res?rt=oic.r.prov";
+#else
+ static const char * UNICAST_PROVISIONING_QUERY = "/oic/res?rt=oic.r.prov";
+#endif
volatile static OCProvisioningStatusCB cbData = NULL;
OCStackResult StartProvisioning(const EnrolleeNWProvInfo *netInfo) {
char findQuery[64] = {0};
+
+#ifdef REMOTE_ARDUINO_ENROLEE
+ //Arduino Enrollee needs mediator application provide IP and port55555 which is specific
+ // to Arduino WiFi enrollee
snprintf(findQuery, sizeof(findQuery) - 1, UNICAST_PROVISIONING_QUERY,
netInfo->netAddressInfo.WIFI.ipAddress, IP_PORT);
+#else
+ OICStrcpy(findQuery, sizeof(UNICAST_PROVISIONING_QUERY), UNICAST_PROVISIONING_QUERY);
+#endif
return StartProvisioningProcess(netInfo, cbData, findQuery);
}
int64_t ps;
if (OCRepPayloadGetPropInt(input, OC_RSRVD_ES_PS, &ps)) {
- if (ps == 1) {
+ if (ps == 2) {
input = input->next;
continue;
}
strncpy(resURI, input->uri, sizeof(resURI) - 1);
+
+#ifdef REMOTE_ARDUINO_ENROLEE
+ //Arduino Enrollee needs mediator application provide IP and port55555 which is specific
+ // to Arduino WiFi enrollee
+ // REMOTE_ARDUINO_ENROLEE has to be defined if Mediator is being tested with Arduino
snprintf(query, sizeof(query), UNICAST_PROV_STATUS_QUERY, clientResponse->addr->addr, IP_PORT,
- resURI);
+ resURI);
+#else
+ snprintf(query, sizeof(query), UNICAST_PROV_STATUS_QUERY, clientResponse->addr->addr,
+ clientResponse->addr->port,
+ resURI);
+#endif
+
if (ProvisionEnrollee(OC_HIGH_QOS, query, OC_RSRVD_ES_URI_PROV, clientResponse->addr, 0)
!= OC_STACK_OK) {
OCDoHandle /*handle*/,
OCClientResponse *clientResponse) {
- OC_LOG(INFO, ES_WIFI_PROV_TAG, PCF("Entering FindProvisioningResourceResponse"));
+ OC_LOG_V(INFO, ES_WIFI_PROV_TAG, "Entering FindProvisioningResourceResponse %s",
+ clientResponse->devAddr.addr);
// If user stopped the process then return from this function;
if (IsSetupStopped()) {
return OC_STACK_DELETE_TRANSACTION;
}
-
if (!ValidateFinddResourceResponse(clientResponse)) {
ErrorCallback(DEVICE_NOT_PROVISIONED);
return OC_STACK_DELETE_TRANSACTION;
OC_LOG_V(DEBUG, ES_WIFI_PROV_TAG, "resUri = %s", discoveryPayload->resources->uri);
+#ifdef REMOTE_ARDUINO_ENROLEE
+ //Arduino Enrollee needs mediator application provide IP and port55555 which is specific
+ // to Arduino WiFi enrollee
+ // REMOTE_ARDUINO_ENROLEE has to be defined if Mediator is being tested with Arduino
+ snprintf(szQueryUri, sizeof(szQueryUri), UNICAST_PROV_STATUS_QUERY,
+ clientResponse->addr->addr,
+ IP_PORT,
+ discoveryPayload->resources->uri);
+#else
snprintf(szQueryUri, sizeof(szQueryUri), UNICAST_PROV_STATUS_QUERY,
- clientResponse->devAddr.addr, IP_PORT, discoveryPayload->resources->uri);
+ clientResponse->devAddr.addr,
+ clientResponse->devAddr.port,
+ discoveryPayload->resources->uri);
+#endif
OC_LOG_V(DEBUG, ES_WIFI_PROV_TAG, "query before GetProvisioningStatus call = %s", szQueryUri);