else:
easy_setup_env.PrependUnique(LIBS = ['oc', 'octbstack', 'oc_logger', 'pthread', 'connectivity_abstraction'])
if target_os == 'arduino':
- if 'BLE' in transport:
- easy_setup_env.AppendUnique(CPPPATH = [
- '../../resource/oc_logger/include',
- '../../resource/csdk/logger/include',
- '../../resource/csdk/stack/include',
- '../../extlibs/cjson',
- 'sdk/enrollee/arduino/ble',
- 'sdk/enrollee/common/src',
- 'sdk/enrollee/common/inc'])
- easy_setup_env.AppendUnique(CPPDEFINES = ['TB_LOG', 'ESBLE'])
- else:
- easy_setup_env.AppendUnique(CPPPATH = [
- '../../resource/oc_logger/include',
- '../../resource/csdk/logger/include',
- '../../resource/csdk/stack/include',
- '../../extlibs/cjson',
- 'sdk/enrollee/arduino/wifi',
- 'sdk/enrollee/common/src',
- 'sdk/enrollee/common/inc'])
- easy_setup_env.AppendUnique(CPPDEFINES = ['TB_LOG', 'ESWIFI'])
+ easy_setup_env.AppendUnique(CPPPATH = [
+ '../../resource/oc_logger/include',
+ '../../resource/csdk/logger/include',
+ '../../resource/csdk/stack/include',
+ '../../extlibs/cjson',
+ 'sdk/enrollee/arduino/wifi',
+ 'sdk/enrollee/common/src',
+ 'sdk/enrollee/common/inc'])
+ easy_setup_env.AppendUnique(CPPDEFINES = ['TB_LOG', 'ESWIFI'])
if target_os in ['android','linux']:
easy_setup_env.PrependUnique(CPPPATH = [
env.get('SRC_DIR') + '/resource/c_common/oic_malloc/include',
######################################################################
if target_os == 'arduino':
- if 'BLE' in transport:
- es_sdk_static = easy_setup_env.StaticLibrary('ESSDKLibrary',
- ['sdk/enrollee/common/src/easysetupble.cpp',
- 'sdk/enrollee/common/src/resourceHandler.cpp'])
- else:
- es_sdk_static = easy_setup_env.StaticLibrary('ESSDKLibrary',
- ['sdk/enrollee/common/src/easysetup.cpp',
- 'sdk/enrollee/common/src/resourceHandler.cpp',
- 'sdk/enrollee/arduino/wifi/networkHandler.cpp'])
+ es_sdk_static = easy_setup_env.StaticLibrary('ESSDKLibrary',
+ ['sdk/enrollee/common/src/easysetup.cpp',
+ 'sdk/enrollee/common/src/resourceHandler.cpp',
+ 'sdk/enrollee/arduino/wifi/networkHandler.cpp'])
easy_setup_env.InstallTarget(es_sdk_static, 'libESSDK')
if target_os == 'android':
- if 'BLE' in transport:
- es_sdk_shared = easy_setup_env.StaticLibrary('libESSDK',
- ['sdk/mediator/src/prov_adapter.cpp',
- 'sdk/mediator/src/ble_provisioning.cpp',
- 'sdk/mediator/src/provisioning.cpp'])
- else :
- es_sdk_shared = easy_setup_env.StaticLibrary('libESSDK',
- ['sdk/mediator/src/prov_adapter.cpp',
- 'sdk/mediator/src/wifi_provisioning.cpp',
- 'sdk/mediator/src/provisioning.cpp'])
+ es_sdk_shared = easy_setup_env.StaticLibrary('libESSDK',
+ ['sdk/mediator/src/prov_adapter.cpp',
+ 'sdk/mediator/src/wifi_provisioning.cpp',
+ 'sdk/mediator/src/provisioning.cpp'])
easy_setup_env.InstallTarget(es_sdk_shared, 'libESSDK')
if target_os == 'linux':
######################################################################
# Build flags
######################################################################
-if 'BLE' in transport:
- enrollee_env.PrependUnique(CPPPATH = [
- '../../../../../resource/oc_logger/include',
- '../../../../../resource/csdk/logger/include',
- '../../../../../resource/csdk/stack/include',
- '../../../../../extlibs/cjson',
- '../../../sdk/common',
- '../../../sdk/enrollee/arduino/ble',
- '../../../sdk/enrollee/common/inc',
- '../../../sdk/enrollee/common/src'
- ])
- enrollee_env.AppendUnique(CPPDEFINES = ['TB_LOG', 'ESBLE'])
-else :
- enrollee_env.PrependUnique(CPPPATH = [
- '../../../../../resource/oc_logger/include',
- '../../../../../resource/csdk/logger/include',
- '../../../../../resource/csdk/stack/include',
- '../../../../../extlibs/cjson',
- '../../../sdk/common',
- '../../../sdk/enrollee/arduino/wifi',
- '../../../sdk/enrollee/common/inc',
- '../../../sdk/enrollee/common/src'
- ])
- enrollee_env.AppendUnique(CPPDEFINES = ['TB_LOG', 'ESWIFI'])
+enrollee_env.PrependUnique(CPPPATH = [
+ '../../../../../resource/oc_logger/include',
+ '../../../../../resource/csdk/logger/include',
+ '../../../../../resource/csdk/stack/include',
+ '../../../../../extlibs/cjson',
+ '../../../sdk/common',
+ '../../../sdk/enrollee/arduino/wifi',
+ '../../../sdk/enrollee/common/inc',
+ '../../../sdk/enrollee/common/src'
+ ])
+enrollee_env.AppendUnique(CPPDEFINES = ['TB_LOG', 'ESWIFI'])
enrollee_env.AppendUnique(LIBPATH = [env.get('BUILD_DIR')])
enrollee_env.PrependUnique(LIBS = ['octbstack','ocsrm','connectivity_abstraction','coap', 'ESSDKLibrary'])
-if 'BLE' in transport:
- enrollee = enrollee_env.Program('enrollee', 'enrollee_ble.cpp')
-else :
- enrollee = enrollee_env.Program('enrollee', 'enrollee_wifi.cpp')
+enrollee = enrollee_env.Program('enrollee', 'enrollee_wifi.cpp')
env.CreateBin('enrollee')
i_enrollee = enrollee_env.Install(env.get('BUILD_DIR'), enrollee)
+++ /dev/null
-//******************************************************************
-//
-// Copyright 2015 Samsung Electronics All Rights Reserved.
-//
-//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-
-// Do not remove the include below
-#include "Arduino.h"
-#include "logger.h"
-#include <string.h>
-#include "easysetup.h"
-
-const char *getResult(OCStackResult result);
-
-PROGMEM const char TAG[] = "ThinServer";
-
-void EventCallbackInApp(ESResult eventFlag)
-{
- Serial.println("callback!!! in app");
-}
-
-// On Arduino Atmel boards with Harvard memory architecture, the stack grows
-// downwards from the top and the heap grows upwards. This method will print
-// the distance(in terms of bytes) between those two.
-// See here for more details :
-// http://www.atmel.com/webdoc/AVRLibcReferenceManual/malloc_1malloc_intro.html
-void PrintArduinoMemoryStats()
-{
-#ifdef ARDUINO_AVR_MEGA2560
- //This var is declared in avr-libc/stdlib/malloc.c
- //It keeps the largest address not allocated for heap
- extern char *__brkval;
- //address of tmp gives us the current stack boundry
- int tmp;
- OC_LOG_V(INFO, TAG, "Stack: %u Heap: %u", (unsigned int)&tmp, (unsigned int)__brkval);
- OC_LOG_V(INFO, TAG, "Unallocated Memory between heap and stack: %u",
- ((unsigned int)&tmp - (unsigned int)__brkval));
-#endif
-}
-//The setup function is called once at startup of the sketch
-void setup()
-{
- // Add your initialization code here
- // Note : This will initialize Serial port on Arduino at 115200 bauds
- OC_LOG_INIT();
- OC_LOG(DEBUG, TAG, PCF("OCServer is starting..."));
-
- if (InitEasySetup(ES_BLE, EventCallbackInApp) == ES_ERROR)
- {
- OC_LOG(ERROR, TAG, "EasySetup Init Failed");
- return;
- }
-
- if (InitProvisioning(EventCallbackInApp) == ES_ERROR)
- {
- OC_LOG(ERROR, TAG, "Init Provisioning Failed");
- return;
- }
-}
-
-// The loop function is called in an endless loop
-void loop()
-{
- // This artificial delay is kept here to avoid endless spinning
- // of Arduino microcontroller. Modify it as per specific application needs.
- delay(2000);
-
- // This call displays the amount of free SRAM available on Arduino
- PrintArduinoMemoryStats();
-
- // Give CPU cycles to OCStack to perform send/recv and other OCStack stuff
- if (OCProcess() != OC_STACK_OK)
- {
- OC_LOG(ERROR, TAG, PCF("OCStack process error"));
- return;
- }
-}
android:versionCode="1"
android:versionName="1.0">
- <uses-feature
- android:name="android.hardware.bluetooth_le"
- android:required="true" />
-
- <uses-permission android:name="android.permission.BLUETOOTH" />
- <uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
android:label="@string/app_name">
<intent-filter>
- <action android:name="android.intent.action.SEND" />
-
- <category android:name="android.intent.category.DEFAULT" />
-
- <data android:mimeType="text/plain" />
- </intent-filter>
- </activity>
-
- <activity android:name=".BLEActivity" />
- <activity android:name=".OnBoardingSelect">
- <intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
+++ /dev/null
-//******************************************************************
-//
-// Copyright 2015 Samsung Electronics All Rights Reserved.
-//
-//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-
-package org.iotivity.service.easysetup;
-
-import java.io.IOException;
-
-import org.iotivity.service.easysetup.core.BleConnection;
-import org.iotivity.service.easysetup.core.EasySetupService;
-import org.iotivity.service.easysetup.core.EasySetupStatus;
-import org.iotivity.service.easysetup.core.EnrolleeDevice;
-import org.iotivity.service.easysetup.core.EnrolleeState;
-import org.iotivity.service.easysetup.impl.BLEOnBoardingConfig;
-import org.iotivity.service.easysetup.impl.EnrolleeDeviceFactory;
-import org.iotivity.service.easysetup.impl.WiFiProvConfig;
-
-import android.app.Activity;
-import android.bluetooth.BluetoothAdapter;
-import android.bluetooth.BluetoothManager;
-import android.content.Context;
-import android.content.Intent;
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.Message;
-import android.util.Log;
-import android.view.View;
-import android.view.View.OnClickListener;
-import android.widget.Button;
-import android.widget.EditText;
-import android.widget.ProgressBar;
-import android.widget.TextView;
-import android.widget.Toast;
-
-public class BLEActivity extends Activity {
-
-
- /*Status to update the UI */
- public static final int SUCCESS = 0;
- public static final int FAILED = 1;
- public static final int STATE_CHANGED = 2;
-
- EditText mEnrolleeSsidText;
- EditText mmEnrolleePasswordPassText;
-
-
- TextView mDeviceNameTextView;
- TextView mDeviceMacTextView;
- TextView mDeviceUuidTextView;
-
- TextView mResultTextView;
- ProgressBar mProgressbar;
- Button mStartButton;
- Button mStopButton;
- Handler mHandler = new ThreadHandler();
-
- /**
- * Objects to be instantiated by the programmer
- */
- WiFiProvConfig mWiFiProvConfig;
- BLEOnBoardingConfig mBleOnBoardingConfig;
- EasySetupService mEasySetupService;
- EnrolleeDeviceFactory mDeviceFactory;
- EnrolleeDevice mDevice;
-
- private final int REQUEST_ENABLE_BT = 1;
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_ble);
-
- /* Initialize widgets to get user input for target network's SSID & password*/
- mEnrolleeSsidText = (EditText) findViewById(R.id.enrolleeSsid);
- mmEnrolleePasswordPassText = (EditText) findViewById(R.id.enrolleePass);
- mDeviceNameTextView = (TextView) findViewById(R.id.devicename);
- mDeviceMacTextView = (TextView) findViewById(R.id.hardAddr);
- mDeviceUuidTextView = (TextView) findViewById(R.id.uuid);
- mResultTextView = (TextView) findViewById(R.id.status);
- mProgressbar = (ProgressBar) findViewById(R.id.progressBar);
- mStartButton = (Button) findViewById(R.id.startSetup);
- mStopButton = (Button) findViewById(R.id.stopSetup);
-
- //default SSID and password
- mEnrolleeSsidText.setText("hub2.4G");
- mmEnrolleePasswordPassText.setText("11112222");
-
- /* Create Easy Setup Service instance*/
- mEasySetupService = EasySetupService.getInstance(getApplicationContext(),
- new EasySetupStatus() {
-
- @Override
- public void onFinished(final EnrolleeDevice enrolledevice) {
- Log.i("BleActivity", "onFinished() is received " + enrolledevice
- .isSetupSuccessful());
- if (enrolledevice.isSetupSuccessful()) {
- mHandler.sendEmptyMessage(SUCCESS);
- } else {
- mHandler.sendEmptyMessage(FAILED);
- }
- }
-
- @Override
- public void onProgress(EnrolleeState state) {
- Log.i("MainActivity", "onProgress() is received ");
- mHandler.sendEmptyMessage(STATE_CHANGED);
- }
-
- });
-
- /* Create EnrolleeDevice Factory instance*/
- mDeviceFactory = EnrolleeDeviceFactory.newInstance(getApplicationContext());
-
- addListnerforStartES();
- addListenerForStopES();
-
-
- }
-
- public void addListnerforStartES() {
-
- mStartButton.setOnClickListener(new OnClickListener() {
- @Override
- public void onClick(View v) {
- mProgressbar.setVisibility(View.VISIBLE);
- mProgressbar.setIndeterminate(true);
- mStartButton.setEnabled(false);
- mResultTextView.setText(R.string.running);
- mStopButton.setEnabled(true);
- start();
- }
- });
- }
-
- public void addListenerForStopES() {
- mStopButton = (Button) findViewById(R.id.stopSetup);
-
- mStopButton.setOnClickListener(new OnClickListener() {
- @Override
- public void onClick(View arg0) {
- mStartButton.setEnabled(true);
- mStopButton.setEnabled(false);
- mResultTextView.setText(R.string.stopped);
- mProgressbar.setIndeterminate(false);
- mProgressbar.setVisibility(View.INVISIBLE);
- mEasySetupService.stopSetup(mDevice);
- }
- });
- }
-
-
- public WiFiProvConfig getEnrollerWifiConfig() {
- /* Provide the credentials for the Mediator Soft AP to be connected by Enrollee*/
- mWiFiProvConfig = new WiFiProvConfig(mEnrolleeSsidText.getText().toString(),
- mmEnrolleePasswordPassText.getText().toString());
- return mWiFiProvConfig;
- }
-
- public BLEOnBoardingConfig getOnBoardingWifiConfig() {
- // Set the uuid of the OIC device here
- mBleOnBoardingConfig = new BLEOnBoardingConfig();
- /*
- set the uuid of the OIC-device, so that the Easysetup API can find the device
- */
- mBleOnBoardingConfig.setUuid("ade3d529-c784-4f63-a987-eb69f70ee816");
-
- return mBleOnBoardingConfig;
- }
-
-
- public void onDestroy() {
- super.onDestroy();
- /*Reset the Easy setup process*/
- if (mEasySetupService != null) {
- mEasySetupService.finish();
- }
- }
-
- public void start() {
- //This function starts the bluetooth adpater so that the easysetup can start scanning for BLE devices
- final BluetoothManager bluetoothManager =
- (BluetoothManager) getSystemService(Context.BLUETOOTH_SERVICE);
- BluetoothAdapter mBluetoothAdapter = bluetoothManager.getAdapter();
-
- if (!mBluetoothAdapter.isEnabled()) {
- //Bluetooth is disabled, enable it
- Intent enableBtIntent = new Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE);
- startActivityForResult(enableBtIntent, REQUEST_ENABLE_BT);
- } else try {
- //IF bluetooth is directly enabled it will directly start the setup of enrollee devices
-
- /* Create a device using Factory instance*/
- mDevice = mDeviceFactory.newEnrolleeDevice(getOnBoardingWifiConfig(),
- getEnrollerWifiConfig());
- mEasySetupService.startSetup(mDevice);
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
-
- @Override
- protected void onActivityResult(int requestCode, int resultCode, Intent data) {
- // User chose not to enable Bluetooth.
- if (requestCode == REQUEST_ENABLE_BT && resultCode == Activity.RESULT_CANCELED) {
- Log.e("error bluetooth", "Bluetooth not enabled..Try again");
- Toast.makeText(BLEActivity.this, "Bluetooth not enabled..Try again", Toast.LENGTH_SHORT).show();
- return;
- } else try {
- //bluetooth is enabled, now start the setup of enrollee devices
- /* Create a device using Factory instance*/
- mDevice = mDeviceFactory.newEnrolleeDevice(getOnBoardingWifiConfig(),
- getEnrollerWifiConfig());
- mEasySetupService.startSetup(mDevice);
- } catch (IOException e) {
- e.printStackTrace();
- }
- super.onActivityResult(requestCode, resultCode, data);
- }
-
-
- class ThreadHandler extends Handler {
- @Override
- public void handleMessage(Message msg) {
-
- switch (msg.what) {
- case SUCCESS: {
-
- mProgressbar.setIndeterminate(false);
- mStopButton.setEnabled(false);
- mStartButton.setEnabled(true);
- mProgressbar.setVisibility(View.INVISIBLE);
- String resultMsg = "Device configured successfully";
- mResultTextView.setText(R.string.success);
-
- /* Update device information on the Ui */
- BleConnection connection = (BleConnection) mDevice
- .getConnection();
- mDeviceNameTextView.setText(connection.getmDeviceName());
- mDeviceMacTextView.setText(connection.getMacaddress());
- mDeviceUuidTextView.setText(connection.getmServiceUUID());
- Toast.makeText(getApplicationContext(), resultMsg, Toast.LENGTH_SHORT).show();
- break;
- }
- case FAILED: {
-
- mProgressbar.setIndeterminate(false);
- mStopButton.setEnabled(false);
- mStartButton.setEnabled(true);
- mProgressbar.setVisibility(View.INVISIBLE);
- String resultMsg = "Device configuration failed";
- mResultTextView.setText(R.string.failed);
- Toast.makeText(getApplicationContext(), resultMsg, Toast.LENGTH_SHORT).show();
- break;
- }
-
- case STATE_CHANGED: {
- String resultMsg = "Device state changed";
- Toast.makeText(getApplicationContext(), resultMsg, Toast.LENGTH_SHORT).show();
- break;
- }
-
- }
-
-
- }
- }
-
-}
+++ /dev/null
-package org.iotivity.service.easysetup;
-
-import android.app.Activity;
-import android.content.Intent;
-import android.os.Bundle;
-import android.view.View;
-import android.widget.Button;
-import android.widget.RadioButton;
-import android.widget.Toast;
-
-public class OnBoardingSelect extends Activity {
-
- RadioButton radio_wifi, radio_ble;
- Button button_continue;
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_on_boarding_select);
-
- radio_wifi = (RadioButton) findViewById(R.id.radioWifi);
- radio_ble = (RadioButton) findViewById(R.id.radioBle);
- button_continue = (Button) findViewById(R.id.button_continue);
-
- button_continue.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- Intent intent;
- if (radio_wifi.isChecked())
- intent = new Intent(OnBoardingSelect.this, MainActivity.class);
- else if (radio_ble.isChecked())
- intent = new Intent(OnBoardingSelect.this, BLEActivity.class);
- else {
-
- Toast.makeText(OnBoardingSelect.this, "Please Select OnBoarding method " +
- "before Continuing", Toast.LENGTH_SHORT).show();
- return;
- }
- startActivity(intent);
- }
- });
- }
-
-
-}
+++ /dev/null
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:tools="http://schemas.android.com/tools"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:background="@drawable/background"
- android:orientation="vertical"
- android:paddingBottom="@dimen/activity_vertical_margin"
- android:paddingLeft="@dimen/activity_horizontal_margin"
- android:paddingRight="@dimen/activity_horizontal_margin"
- android:paddingTop="@dimen/activity_vertical_margin"
- tools:context="org.iotivity.service.easysetup.BLEActivity">
-
-
- <ProgressBar
- android:id="@+id/progressBar"
- style="?android:attr/progressBarStyleHorizontal"
- android:layout_width="350dp"
- android:layout_height="wrap_content"
- android:visibility="invisible" />
-
-
- <LinearLayout
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_gravity="center"
- android:layout_marginTop="5dp"
- android:orientation="horizontal">
-
-
- <TextView
- android:id="@+id/lablestatus"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_marginLeft="8dp"
- android:layout_marginRight="20dp"
- android:elegantTextHeight="true"
- android:text="@string/test_status"
- android:textSize="15sp" />
-
- <TextView
- android:id="@+id/status"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_marginLeft="10dp"
- android:layout_marginRight="30dp"
- android:text="@string/not_started"
- android:textColor="@android:color/background_light"
- android:textSize="20dp" />
-
- </LinearLayout>
-
- <LinearLayout
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_centerHorizontal="true"
- android:layout_gravity="center"
- android:layout_marginTop="10dp"
- android:orientation="vertical">
-
- <TextView
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="Enter Enroller's SSID" />
-
-
- <EditText
- android:id="@+id/enrolleeSsid"
- android:layout_width="250dp"
- android:layout_height="wrap_content"
- android:layout_gravity="center_horizontal" />
-
-
- <TextView
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_marginTop="10dp"
- android:text="Enter Enroller's Password" />
-
-
- <EditText
- android:id="@+id/enrolleePass"
- android:layout_width="250dp"
- android:layout_height="wrap_content"
-
- android:layout_gravity="center_horizontal" />
-
- </LinearLayout>
-
-
- <TextView
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_gravity="center_horizontal"
- android:layout_marginTop="5dp"
- android:text="Device information"
- android:textAppearance="?android:attr/textAppearanceMedium" />
-
- <RelativeLayout
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_centerHorizontal="true"
- android:layout_gravity="center"
- android:layout_marginTop="10dp"
- android:orientation="vertical">
-
- <TextView
- android:id="@+id/devicenamelabel"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_gravity="center_horizontal"
- android:text="Device Name:"
- android:textAppearance="?android:attr/textAppearanceSmall" />
-
- <TextView
- android:id="@+id/devicename"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_gravity="center_horizontal"
- android:layout_toRightOf="@id/devicenamelabel"
- android:text="@string/not_available"
-
- android:textAppearance="?android:attr/textAppearanceSmall" />
-
- <TextView
- android:id="@+id/uuidLable"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_below="@id/devicenamelabel"
- android:layout_gravity="center_horizontal"
- android:text="UUID:"
- android:textAppearance="?android:attr/textAppearanceSmall" />
-
- <TextView
- android:id="@+id/uuid"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_below="@id/devicename"
- android:layout_gravity="center_horizontal"
- android:layout_toRightOf="@id/uuidLable"
- android:text="@string/not_available"
-
- android:textAppearance="?android:attr/textAppearanceSmall" />
-
-
- <TextView
- android:id="@+id/hardAddrLable"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_below="@id/uuidLable"
- android:layout_gravity="center_horizontal"
- android:text="MAC Address:"
- android:textAppearance="?android:attr/textAppearanceSmall" />
-
- <TextView
- android:id="@+id/hardAddr"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_below="@id/uuid"
- android:layout_gravity="center_horizontal"
- android:layout_toRightOf="@id/hardAddrLable"
- android:text="@string/not_available"
- android:textAppearance="?android:attr/textAppearanceSmall" />
-
-
- </RelativeLayout>
-
-
- <LinearLayout
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_centerHorizontal="true"
- android:layout_gravity="center"
- android:layout_marginTop="20dp"
- android:orientation="horizontal">
-
- <Button
- android:id="@+id/startSetup"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_alignParentTop="true"
- android:layout_centerHorizontal="true"
- android:layout_margin="10dp"
- android:layout_marginTop="20dp"
- android:elegantTextHeight="true"
- android:text="@string/startSetup"
- android:textAllCaps="false"
- android:textSize="18sp" />
-
- <Button
- android:id="@+id/stopSetup"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_below="@+id/startSetup"
- android:layout_centerHorizontal="true"
- android:layout_margin="10dp"
- android:elegantTextHeight="true"
- android:enabled="false"
- android:text="@string/stopSetup"
- android:textAllCaps="false"
- android:textSize="18sp" />
-
- </LinearLayout>
-
-</LinearLayout>
\ No newline at end of file
+++ /dev/null
-<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:tools="http://schemas.android.com/tools"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:background="@drawable/background"
- android:paddingBottom="@dimen/activity_vertical_margin"
- android:paddingLeft="@dimen/activity_horizontal_margin"
- android:paddingRight="@dimen/activity_horizontal_margin"
- android:paddingTop="@dimen/activity_vertical_margin"
- tools:context="org.iotivity.service.easysetup.OnBoardingSelect">
-
- <RadioGroup
- android:id="@+id/radiotype"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_centerHorizontal="true"
- android:layout_marginTop="75dp">
-
- <RadioButton
- android:id="@+id/radioWifi"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:checked="true"
- android:text="Soft AP/WIFI" />
-
- <RadioButton
- android:id="@+id/radioBle"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="BLE" />
-
- </RadioGroup>
-
- <Button
- android:id="@+id/button_continue"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_centerHorizontal="true"
- android:layout_centerVertical="true"
- android:text="Continue" />
-
-
-</RelativeLayout>
-<menu xmlns:android="http://schemas.android.com/apk/res/android"\r
- xmlns:app="http://schemas.android.com/apk/res-auto"\r
- xmlns:tools="http://schemas.android.com/tools"\r
- tools:context="org.iotivity.service.easysetup.MainActivity" >\r
-\r
- <item\r
- android:id="@+id/action_settings"\r
- android:orderInCategory="100"\r
- android:title="@string/action_settings"/>\r
-\r
-</menu>\r
+<menu xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:app="http://schemas.android.com/apk/res-auto"
+ xmlns:tools="http://schemas.android.com/tools"
+ tools:context="org.iotivity.service.easysetup.MainActivity" >
+
+ <item
+ android:id="@+id/action_settings"
+ android:orderInCategory="100"
+ android:title="@string/action_settings"/>
+
+</menu>
+++ /dev/null
-<menu xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:tools="http://schemas.android.com/tools"
- tools:context="org.iotivity.service.easysetup.BLEActivity">
- <item
- android:id="@+id/action_settings"
- android:orderInCategory="100"
- android:showAsAction="never"
- android:title="@string/action_settings" />
-</menu>
static const char * UNICAST_PROVISIONING_QUERY = "coap://%s:%d/oic/res?rt=oic.prov";
static const char * UNICAST_PROV_STATUS_QUERY = "coap://%s:%d%s";
-static const char * UNICAST_PROVISIONING_QUERY_BLE = "coap://%s/oic/prov";
-static const char * MULTICAST_PROVISIONING_QUERY_BLE = "/oic/res?rt=oic.prov";
-
-
/**
* Attributes used to form a proper easysetup conforming JSON message.
*/
+++ /dev/null
-//******************************************************************
-//
-// Copyright 2014 Samsung Electronics All Rights Reserved.
-//
-//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-
-// Do not remove the include below
-#include "Arduino.h"
-
-#include "logger.h"
-#include "ocstack.h"
-#include <string.h>
-
-#include "common.h"
-
-#ifndef ES_NETWORK_HANDLER_H_
-#define ES_NETWORK_HANDLER_H_
-
-#define MAXSSIDLEN 33
-#define MAXNETCREDLEN 20
-#define MAXNUMTYPE 5
-#define MAXADDRLEN 15
-
-typedef void (*NetworkEventCallback)(ESResult);
-
-enum NetworkType
-{
- ES_WIFI = 1, ES_BT = 2, ES_BLE = 3, ES_ZIGBEE = 4, ES_ETH = 5
-};
-typedef struct NETWORKINFO
-{
- NetworkType type;
- byte mac[6];
-} NetworkInfo;
-
-#endif
+++ /dev/null
-//******************************************************************
-//
-// Copyright 2015 Samsung Electronics All Rights Reserved.
-//
-//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-
-#include "easysetup.h"
-#include "logger.h"
-#include "resourceHandler.h"
-
-#define TAG "ES"
-
-int g_eventflag = 0;
-int g_cnt = 0;
-char *targetSsid;
-char *targetPass;
-
-EventCallback g_cbForProvisioning = NULL;
-EventCallback g_cbForOnboarding = NULL;
-
-void EventCallbackInOnboarding(ESResult event);
-void EventCallbackInProvisioning(ESResult event);
-void EventCallbackAfterProvisioning(ESResult event);
-
-void EventCallbackInOnboarding(ESResult event)
-{
- if (event == ES_NETWORKFOUND || event == ES_NETWORKCONNECTED)
- {
- if (g_cbForOnboarding != NULL)
- {
- g_cbForOnboarding(event);
- }
- }
-}
-
-void EventCallbackInProvisioning(ESResult event)
-{
- ESResult res = ES_OK;
-
- if (event == ES_RECVTRIGGEROFPROVRES)
- {
- targetSsid = (char *) malloc(MAXSSIDLEN);
- targetPass = (char *) malloc(MAXNETCREDLEN);
-
- if (TerminateEasySetup() != OC_STACK_OK)
- {
- OC_LOG(ERROR, TAG, "Terminating stack failed");
- return;
- }
-
- GetTargetNetworkInfoFromProvResource(targetSsid, targetPass);
-
- OC_LOG(INFO, TAG, targetSsid);
- OC_LOG(INFO, TAG, targetPass);
- OC_LOG(INFO, TAG, "Device Provisioned");
-
- // cannot connect to target network, as currently arduino supports only one transport at a time
- //res = ConnectToWiFiNetwork(targetSsid, targetPass, EventCallbackAfterProvisioning);
-
- if (g_cbForProvisioning != NULL)
- {
- g_cbForProvisioning(res);
- }
- }
-}
-
-void EventCallbackAfterProvisioning(ESResult event)
-{
- if (event == ES_NETWORKFOUND || event == ES_NETWORKCONNECTED)
- {
- if (g_cbForProvisioning != NULL)
- {
- g_cbForProvisioning(event);
- }
- }
-}
-
-ESResult InitEasySetup(NetworkType networkType, EventCallback cb)
-{
-
- // Initialize the OC Stack in Server mode
- //if (OCInit(NULL, 0, OC_SERVER) != OC_STACK_OK)
- if (OCInit1(OC_SERVER, OC_DEFAULT_FLAGS, OC_DEFAULT_FLAGS) != OC_STACK_OK)
- {
- OC_LOG(ERROR, TAG, "OCStack init error");
- return ES_ERROR;
- }
- else
- {
- OC_LOG(DEBUG, TAG, "OCStack init success");
- return ES_OK;
- }
-}
-
-ESResult TerminateEasySetup()
-{
- if (OCStop() != OC_STACK_OK)
- {
- OC_LOG(ERROR, TAG, "OCStack stop failed");
- return ES_ERROR;
- }
- else
- {
- OC_LOG(ERROR, TAG, "OCStack stop success");
- return ES_OK;
- }
-}
-
-ESResult InitProvisioning(EventCallback cb)
-{
- if (cb == NULL)
- {
- return ES_ERROR;
- }
- else
- {
- g_cbForProvisioning = cb;
- }
-
- if (CreateProvisioningResource() != OC_STACK_OK)
- {
- return ES_ERROR;
- }
-
- RegisterResourceEventCallBack( EventCallbackInProvisioning);
-
- return ES_RESOURCECREATED;
-}
-
\r
import android.net.wifi.WifiConfiguration;\r
import android.test.AndroidTestCase;\r
-import android.test.mock.MockApplication;\r
import android.util.Log;\r
\r
-import org.iotivity.service.easysetup.impl.BLEOnBoardingConfig;\r
-import org.iotivity.service.easysetup.impl.EnrolleeDeviceBLEOnBoarding;\r
import org.iotivity.service.easysetup.impl.EnrolleeDeviceFactory;\r
import org.iotivity.service.easysetup.impl.EnrolleeDeviceWiFiOnboarding;\r
import org.iotivity.service.easysetup.impl.WiFiOnBoardingConfig;\r
\r
}\r
\r
- public void testStartSetupWithBleOnboarding() {\r
-\r
- final String UUID = "ade3d529-c784-4f63-a987-eb69f70ee816";\r
-\r
- EasySetupService mService;\r
- EnrolleeDevice mDevice;\r
- EnrolleeDeviceFactory mFactory;\r
-\r
- final Object lock = new Object();\r
-\r
-\r
- /* Create Easy Setup service */\r
- mService = EasySetupService.getInstance(getContext(), new EasySetupStatus() {\r
- @Override\r
- public void onFinished(EnrolleeDevice enrolledevice) {\r
-\r
- //countDownLatch.countDown();\r
- Utility.toNotify(lock);\r
-\r
- if (enrolledevice.isSetupSuccessful()) {\r
-\r
- if (enrolledevice.mOnBoardingConfig.getConnType() == WiFiOnBoardingConfig.ConnType.BLE) {\r
- BleConnection conn = (BleConnection) enrolledevice.getConnection();\r
- String mac = conn.getMacaddress();\r
- if (mac == null || mac.isEmpty()) {\r
- assertTrue(false);\r
- return;\r
- }\r
-\r
- String uuid = conn.getmServiceUUID();\r
- if (uuid == null || uuid.isEmpty()) {\r
- assertTrue(false);\r
- return;\r
- }\r
-\r
- // Conform that device are same\r
- if (!uuid.equals(UUID)) {\r
- assertTrue(false);\r
- return;\r
- }\r
-\r
- // Device configured successfully\r
- assertTrue(true);\r
- }\r
-\r
- } else {\r
- assertTrue(false);\r
- }\r
- }\r
-\r
- @Override\r
- public void onProgress(EnrolleeState state) {\r
- // TODO\r
- }\r
- });\r
-\r
-\r
- /* Create On boarding configuration */\r
-\r
- BLEOnBoardingConfig bleOnBoardingConfig = new BLEOnBoardingConfig();\r
- bleOnBoardingConfig.setUuid("ade3d529-c784-4f63-a987-eb69f70ee816");\r
-\r
- /* Create provisioning configuration */\r
- WiFiProvConfig mWiFiProvConfig = new WiFiProvConfig("hub2.4G", "11112222");\r
-\r
- /* Create enrolling device factory instance */\r
- mFactory = EnrolleeDeviceFactory.newInstance(getContext());\r
-\r
- /* Check if the factory created successfully */\r
- assertTrue(mFactory != null);\r
-\r
- /* Create enrolling device */\r
- mDevice = mFactory.newEnrolleeDevice(bleOnBoardingConfig, mWiFiProvConfig);\r
-\r
- /* Check if the the device is created successfully*/\r
- assertTrue(mDevice != null);\r
-\r
- /* Check if the the correct device is created as per the given configuration*/\r
-\r
- /* Check if the the correct device is created as per the given configuration*/\r
- assertTrue((mDevice instanceof EnrolleeDeviceBLEOnBoarding));\r
-\r
-\r
- try {\r
- mService.startSetup(mDevice);\r
- // If no exception is thrown means setup started successfully.\r
- assertTrue(true);\r
-\r
- } catch (IOException e) {\r
- assertTrue(false);\r
- }\r
-\r
- try {\r
-\r
- Utility.toWait(lock);\r
-\r
- Log.i("EasySetupTest", "Lock is released");\r
-\r
- if(! mDevice.isSetupSuccessful()) {\r
- assertTrue(false);\r
- return;\r
- }\r
-\r
-\r
- BleConnection conn = (BleConnection) mDevice.getConnection();\r
- if (conn == null) {\r
- assertTrue(false);\r
- return;\r
- }\r
-\r
- String mac = conn.getMacaddress();\r
- if (mac == null || mac.isEmpty()) {\r
- assertTrue(false);\r
- return;\r
- }\r
-\r
- String uuid = conn.getmServiceUUID();\r
- if (uuid == null || uuid.isEmpty()) {\r
- assertTrue(false);\r
- return;\r
- }\r
-\r
- if (!uuid.equals(UUID)) {\r
- assertTrue(false);\r
- return;\r
- }\r
-\r
- Log.i("EasySetupTest", "MAC " + mac);\r
- Log.i("EasySetupTest", "UUID " + uuid);\r
-\r
- // Device configured successfully\r
- assertTrue(true);\r
-\r
- } catch (Exception e) {\r
- e.printStackTrace();\r
- assertTrue(false);\r
- }\r
-\r
- }\r
-\r
-\r
}
\ No newline at end of file
import android.net.wifi.WifiConfiguration;\r
import android.test.AndroidTestCase;\r
\r
-import org.iotivity.service.easysetup.impl.BLEOnBoardingConfig;\r
-import org.iotivity.service.easysetup.impl.EnrolleeDeviceBLEOnBoarding;\r
import org.iotivity.service.easysetup.impl.EnrolleeDeviceFactory;\r
import org.iotivity.service.easysetup.impl.EnrolleeDeviceWiFiOnboarding;\r
import org.iotivity.service.easysetup.impl.WiFiOnBoardingConfig;\r
\r
}\r
\r
- public void testNewEnrolleeDevice_with_BleOnboarding() {\r
-\r
- /* Create On boarding configuration */\r
-\r
- BLEOnBoardingConfig bleOnBoardingConfig = new BLEOnBoardingConfig();\r
- bleOnBoardingConfig.setUuid("ade3d529-c784-4f63-a987-eb69f70ee816");\r
-\r
- /* Create provisioning configuration */\r
- WiFiProvConfig mWiFiProvConfig = new WiFiProvConfig("hub2.4G", "11112222");\r
-\r
- /* Create enrolling device */\r
- EnrolleeDevice device = mFactory.newEnrolleeDevice(bleOnBoardingConfig, mWiFiProvConfig);\r
-\r
- /* Check if the the device is created */\r
- assertTrue(device != null);\r
-\r
- /* Check if the the correct device is created as per the given configuration*/\r
- assertTrue((device instanceof EnrolleeDeviceBLEOnBoarding));\r
-\r
- }\r
-\r
-\r
-\r
}\r
-<manifest xmlns:android="http://schemas.android.com/apk/res/android"\r
- package="org.iotivity.service.easysetup.mediator"\r
- android:versionCode="1"\r
- android:versionName="1.0" >\r
-\r
- <uses-sdk\r
- android:minSdkVersion="8"\r
- android:targetSdkVersion="21" />\r
-\r
- <application\r
- android:allowBackup="true"\r
- android:icon="@drawable/ic_launcher"\r
- android:label="@string/app_name"\r
- android:theme="@style/AppTheme" >\r
- </application>\r
-\r
-</manifest>\r
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="org.iotivity.service.easysetup.mediator"
+ android:versionCode="1"
+ android:versionName="1.0" >
+
+ <uses-sdk
+ android:minSdkVersion="8"
+ android:targetSdkVersion="21" />
+
+ <application
+ android:allowBackup="true"
+ android:icon="@drawable/ic_launcher"
+ android:label="@string/app_name"
+ android:theme="@style/AppTheme" >
+ </application>
+
+</manifest>
+++ /dev/null
-//******************************************************************
-//
-// Copyright 2015 Samsung Electronics All Rights Reserved.
-//
-//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-package org.iotivity.service.easysetup.core;
-
-public class BleConnection implements OnBoardingConnection {
-
- private boolean mIsConnected;
- private String mServiceUUID;
- private String macaddress;
- private String mDeviceName;
-
- public void setConnectivity(boolean connected) {
- mIsConnected = connected;
- }
-
- public void setmServiceUUID(String uuid) {
- mServiceUUID = uuid;
- }
-
- public String getmServiceUUID() {
- return mServiceUUID;
- }
-
- public void setMacaddress(String address) {
- macaddress = address;
- }
-
- public String getMacaddress() {
- return macaddress;
- }
-
- @Override
- public String getDesc() {
- return "Description";
- }
-
- @Override
- public boolean isConnected() {
- return mIsConnected;
- }
-
- @Override
- public Object getConnection() {
- return this;
- }
-
- public String getmDeviceName() {
- return mDeviceName;
- }
-
- public void setmDeviceName(String mDeviceName) {
- this.mDeviceName = mDeviceName;
- }
-}
* This is an abstract class represents the device being provisioned into the network. The\r
* device being enrolled or provisioned into the network is called Enrollee.\r
* Application has to extend this class and provide implementation of abstract methods according\r
- * to the ON-BOARDING & PROVISION connectivity i.e. WiFi, BLE, BT etc. the device is having.\r
+ * to the ON-BOARDING & PROVISION connectivity i.e. WiFi etc.\r
*/\r
\r
public abstract class EnrolleeDevice {\r
+++ /dev/null
-//******************************************************************
-//
-// Copyright 2015 Samsung Electronics All Rights Reserved.
-//
-//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-package org.iotivity.service.easysetup.impl;
-
-import org.iotivity.service.easysetup.core.OnBoardingConfig;
-
-import java.util.UUID;
-
-
-public class BLEOnBoardingConfig implements OnBoardingConfig {
- private final ConnType mConnType = ConnType.BLE;
- private String macaddress;
- private UUID uuid;
-
- @Override
- public Object getConfig() {
- return null;
- }
-
- @Override
- public ConnType getConnType() {
- return mConnType;
- }
-
-
- public UUID getUuid() {
- return uuid;
- }
-
- public void setUuid(String uuid) {
- this.uuid = UUID.fromString(uuid);
- }
-
- public String getMacaddress() {
- return macaddress;
- }
-
- public void setMacaddress(String macaddress) {
- this.macaddress = macaddress;
- }
-}
+++ /dev/null
-//******************************************************************
-//
-// Copyright 2015 Samsung Electronics All Rights Reserved.
-//
-//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-package org.iotivity.service.easysetup.impl;
-
-import android.content.Context;
-import android.util.Log;
-
-import org.iotivity.base.OcConnectivityType;
-import org.iotivity.service.easysetup.core.BleConnection;
-import org.iotivity.service.easysetup.core.OnBoardingConnection;
-import org.iotivity.service.easysetup.core.EnrolleeDevice;
-import org.iotivity.service.easysetup.core.EnrolleeState;
-import org.iotivity.service.easysetup.core.OnBoardingConfig;
-import org.iotivity.service.easysetup.core.ProvisioningConfig;
-import org.iotivity.service.easysetup.mediator.EasySetupManager;
-import org.iotivity.service.easysetup.mediator.EnrolleeInfo;
-import org.iotivity.service.easysetup.mediator.IOnBoardingStatus;
-import org.iotivity.service.easysetup.mediator.IProvisioningListener;
-import org.iotivity.service.easysetup.mediator.ProvisionEnrollee;
-import org.iotivity.service.easysetup.mediator.ble.BLEManager;
-
-public class EnrolleeDeviceBLEOnBoarding extends EnrolleeDevice {
- /**
- * @param onBoardingConfig Contains details about the connectivity to be established between
- * the Enrollee device & Mediator device in order to perform
- * on-boarding
- * @param provConfig Contains details about the network to which Enrollee device is
- */
- public static final String TAG = EnrolleeDeviceWiFiOnboarding.class.getName();
-
- final Context mContext;
- BLEManager bleManager;
- EnrolleeInfo connectedDevice;
- ProvisionEnrollee provisionEnrolleInstance;
- private EasySetupManager easySetupManagerNativeInstance;
-
-
- IOnBoardingStatus deviceScanListener = new IOnBoardingStatus() {
-
- @Override
- public void deviceOnBoardingStatus(EnrolleeInfo enrolleStatus) {
- Log.d("ESBLEOnBoarding", "Entered");
- if (enrolleStatus != null && enrolleStatus.getHWAddr() != null) {
- String finalResult = "Easy Connect : ";
-
- if (enrolleStatus.isReachable()) {
- finalResult = "Device OnBoarded" + "["
- + enrolleStatus.getHWAddr() + "]";
- connectedDevice = enrolleStatus;
- BleConnection conn = new BleConnection();
- conn.setMacaddress(connectedDevice.getHWAddr());
- conn.setConnectivity(true);
- conn.setmServiceUUID(connectedDevice.getIpAddr());
- conn.setmDeviceName(connectedDevice.getDevice());
- Log.d("ESBLEOnBoarding", "Entered" + ":" + finalResult);
- mOnBoardingCallback.onFinished(conn);
- return;
-
- }
- }
-
- BleConnection conn = new BleConnection();
- conn.setConnectivity(false);
- mOnBoardingCallback.onFinished(conn);
-
-
- }
- };
-
- protected EnrolleeDeviceBLEOnBoarding(Context context, OnBoardingConfig onBoardingConfig,
- ProvisioningConfig provConfig) {
- super(onBoardingConfig, provConfig);
- mContext = context;
- bleManager = new BLEManager(mContext, (BLEOnBoardingConfig) onBoardingConfig);
- }
-
- @Override
- protected void startOnBoardingProcess() {
- Log.i(TAG, "Starging on boarding process");
-
- boolean status = bleManager.setupBluetooth();
- mState = EnrolleeState.DEVICE_ON_BOARDING_STATE;
- Log.i(TAG, "Bluetooth started with status " + status);
- if (status) {
- Log.i(TAG, "Scanning available BLE devices");
- bleManager.startScan(deviceScanListener);
-
- }
-
- }
-
- @Override
- protected void stopOnBoardingProcess() {
-
- if (bleManager != null)
- bleManager.stopscan();
-
- }
-
- @Override
- protected void startProvisioningProcess(OnBoardingConnection conn) {
-
- Log.i("start provisioning BLE", mProvConfig.getConnType() + "");
-
- mState = EnrolleeState.DEVICE_PROVISIONING_STATE;
- provisionEnrolleInstance = new ProvisionEnrollee(mContext);
- provisionEnrolleInstance.registerProvisioningHandler(new IProvisioningListener() {
- @Override
- public void onFinishProvisioning(int statuscode) {
- mState = (statuscode == 0) ? EnrolleeState.DEVICE_PROVISIONING_SUCCESS_STATE :
- EnrolleeState.DEVICE_PROVISIONING_FAILED_STATE;
- mProvisioningCallback.onFinished(EnrolleeDeviceBLEOnBoarding.this);
- }
- });
-
- BleConnection connection = (BleConnection) conn;
- WiFiProvConfig wifiProvConfig = (WiFiProvConfig) mProvConfig;
- easySetupManagerNativeInstance = EasySetupManager.getInstance();
- easySetupManagerNativeInstance.setApplicationContext(mContext);
- easySetupManagerNativeInstance.initEasySetup();
- Log.d("init", "successful");
-
- easySetupManagerNativeInstance.provisionEnrollee(connection.getMacaddress(),
- wifiProvConfig.getSsId(),
- wifiProvConfig.getPassword(),
- mOnBoardingConfig.getConnType().getValue());
-
-
- }
-}
\ No newline at end of file
/**
* ***************************************************************
- * <p>
+ * <p/>
* Copyright 2015 Samsung Electronics All Rights Reserved.
- * <p>
- * <p>
- * <p>
+ * <p/>
+ * <p/>
+ * <p/>
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- * <p>
+ * <p/>
* http://www.apache.org/licenses/LICENSE-2.0
- * <p>
+ * <p/>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- * <p>
+ * <p/>
* ****************************************************************
*/
public EnrolleeDevice newEnrolleeDevice(OnBoardingConfig onboardingConfig, ProvisioningConfig provConfig) {
- EnrolleeDevice enrolleeDevice;
- if (onboardingConfig.getConnType() == OnBoardingConfig.ConnType.WiFi) {
- enrolleeDevice = new EnrolleeDeviceWiFiOnboarding(mContext, onboardingConfig, provConfig);
- } else if (onboardingConfig.getConnType() == OnBoardingConfig.ConnType.BLE)
- enrolleeDevice = new EnrolleeDeviceBLEOnBoarding(mContext, onboardingConfig, provConfig);
-
- else {
+ if (onboardingConfig.getConnType() != OnBoardingConfig.ConnType.WiFi) {
throw new IllegalArgumentException("OnBoarding configuration is not supported");
}
+ EnrolleeDevice enrolleeDevice;
+ enrolleeDevice = new EnrolleeDeviceWiFiOnboarding(mContext, onboardingConfig, provConfig);
+
return enrolleeDevice;
}
WiFiProvConfig wifiProvConfig = (WiFiProvConfig) mProvConfig;\r
\r
easySetupManagerNativeInstance = EasySetupManager.getInstance();\r
+ easySetupManagerNativeInstance.setApplicationContext(mContext);\r
easySetupManagerNativeInstance.initEasySetup();\r
\r
// Native Api call to start provisioning of the enrolling device\r
#include "prov_adapter.h"
void JNIProvisioningStatusCallback(ProvisioningInfo * provInfo) {
- JNIEnv *env = EasySetupJVM::getEnv();
- if (env == NULL) {
- LOGE("JNIProvisioningStatusCallback : Getting JNIEnv failed");
- return;
- }
-
- // Get EasySetupHandler class reference
- jclass easysetupCallbacks = GetJClass(EASY_SETUP_SERVICE_CALLBACK_NATIVE_API_CLASS_PATH);
- if (NULL == easysetupCallbacks) {
- LOGE("JNIProvisioningStatusCallback : GetJClass easysetupCallbacks failed");
- EasySetupJVM::releaseEnv();
- return;
- }
-
- // Get the easysetupCallback class instance
- jobject jobjectCallback = GetJObjectInstance(EASY_SETUP_SERVICE_CALLBACK_NATIVE_API_CLASS_PATH);
- if (NULL == jobjectCallback) {
- LOGE("getInstance( %s) failed!", EASY_SETUP_SERVICE_CALLBACK_NATIVE_API_CLASS_PATH);
- EasySetupJVM::releaseEnv();
- return;
- }
-
- // Get onResourceCallback method reference
- jmethodID method_id = env->GetMethodID(easysetupCallbacks, "ProvisioningStatusCallBack",
- METHOD_PROVISIONING_STATUS_INTEGER_CALLBACK);
- if (NULL == method_id) {
- LOGE("JNIProvisioningStatusCallback: onResourceCallback : GetMethodID failed");
- EasySetupJVM::releaseEnv();
- return;
- }
-
- if ((env)->ExceptionCheck()) {
- LOGE("JNIProvisioningStatusCallback : ExceptionCheck failed");
- EasySetupJVM::releaseEnv();
- return;
- }
-
- if (NULL == method_id) {
- LOGI("JNI method_id is NULL");
- }
- else {
- LOGI("JNI method_id is VALID");
-
- jint result;
- if (provInfo->provStatus == DEVICE_PROVISIONED) {
- result = 0;
- }
- else {
- result = -1;
- }
-
- env->CallVoidMethod(jobjectCallback, method_id, (jint) result);
- }
-
- EasySetupJVM::releaseEnv();
+ JNIEnv *env = EasySetupJVM::getEnv();
+ if (env == NULL) {
+ LOGE("JNIProvisioningStatusCallback : Getting JNIEnv failed");
+ return;
+ }
+
+ // Get EasySetupHandler class reference
+ jclass easysetupCallbacks = GetJClass(
+ EASY_SETUP_SERVICE_CALLBACK_NATIVE_API_CLASS_PATH);
+ if (NULL == easysetupCallbacks) {
+ LOGE(
+ "JNIProvisioningStatusCallback : GetJClass easysetupCallbacks failed");
+ EasySetupJVM::releaseEnv();
+ return;
+ }
+
+ // Get the easysetupCallback class instance
+ jobject jobjectCallback = GetJObjectInstance(
+ EASY_SETUP_SERVICE_CALLBACK_NATIVE_API_CLASS_PATH);
+ if (NULL == jobjectCallback) {
+ LOGE("getInstance( %s) failed!",
+ EASY_SETUP_SERVICE_CALLBACK_NATIVE_API_CLASS_PATH);
+ EasySetupJVM::releaseEnv();
+ return;
+ }
+
+ // Get onResourceCallback method reference
+ jmethodID method_id = env->GetMethodID(easysetupCallbacks,
+ "ProvisioningStatusCallBack",
+ METHOD_PROVISIONING_STATUS_INTEGER_CALLBACK);
+ if (NULL == method_id) {
+ LOGE(
+ "JNIProvisioningStatusCallback: onResourceCallback : GetMethodID failed");
+ EasySetupJVM::releaseEnv();
+ return;
+ }
+
+ if ((env)->ExceptionCheck()) {
+ LOGE("JNIProvisioningStatusCallback : ExceptionCheck failed");
+ EasySetupJVM::releaseEnv();
+ return;
+ }
+
+ if (NULL == method_id) {
+ LOGI("JNI method_id is NULL");
+ } else {
+ LOGI("JNI method_id is VALID");
+
+ jint result;
+ if (provInfo->provStatus == DEVICE_PROVISIONED) {
+ result = 0;
+ } else {
+ result = -1;
+ }
+
+ env->CallVoidMethod(jobjectCallback, method_id, (jint) result);
+ }
+
+ EasySetupJVM::releaseEnv();
}
JNIEXPORT void JNICALL
JNIInitEasySetup(JNIEnv
-*env,
-jobject thisObj
+ *env,
+ jobject thisObj
)
{
-LOGI("JNI JNIInitEasySetup: Enter");
+ LOGI("JNI JNIInitEasySetup: Enter");
-InitProvProcess();
+ InitProvProcess();
-RegisterCallback(JNIProvisioningStatusCallback);
+ RegisterCallback(JNIProvisioningStatusCallback);
}
JNIEXPORT void JNICALL
JNITerminateEasySetup(JNIEnv
-*env,
-jobject thisObj
+ *env,
+ jobject thisObj
)
{
-LOGI("JNI JNITerminateEasySetup: Enter");
+ LOGI("JNI JNITerminateEasySetup: Enter");
-ResetProvProcess();
+ ResetProvProcess();
}
JNIEXPORT void JNICALL
JNIProvisionEnrollee(JNIEnv
-*env,
-jobject thisObj,
- jstring
-jIPAddress,
-jstring jNetSSID,
- jstring
-jNetPWD,
-jint jConnectivityType
+ *env,
+ jobject thisObj,
+ jstring
+ jIPAddress,
+ jstring jNetSSID,
+ jstring
+ jNetPWD,
+ jint jConnectivityType
)
{
-LOGI("JNI JNIProvisionEnrollee: Enter");
-
-if (!jIPAddress)
-{
-LOGE("JNI JNIProvisionEnrollee : jIPAddress is NULL!");
-return;
-}
-
-const char *ipAddress = env->GetStringUTFChars(jIPAddress, NULL);
-if (NULL == ipAddress)
-{
-LOGE("JNI JNIProvisionEnrollee : Failed to convert jstring to char string!");
-}
-
-LOGI("JNI JNIProvisionEnrollee : ipAddress is : %s",ipAddress);
-
-const char *netSSID = env->GetStringUTFChars(jNetSSID, NULL);
-if (NULL == netSSID)
-{
-LOGE("JNI JNIProvisionEnrollee : Failed to convert jstring to char string!");
-}
-
-LOGI("JNI JNIProvisionEnrollee : netSSID is : %s",netSSID);
-
-const char *netPWD = env->GetStringUTFChars(jNetPWD, NULL);
-if (NULL == netPWD)
-{
-LOGE("JNI JNIProvisionEnrollee : Failed to convert jstring to char string!");
-}
-
-LOGI("JNI JNIProvisionEnrollee : netPWD is : %s",netPWD);
-
-OCConnectivityType connecitivityType;
-EnrolleeNWProvInfo_t netInfo =
- {0};
-strncpy(netInfo
-.netAddressInfo.WIFI.ipAddress, ipAddress, IPV4_ADDR_SIZE-1);
-strncpy(netInfo
-.netAddressInfo.WIFI.ssid, netSSID, NET_WIFI_SSID_SIZE-1);
-strncpy(netInfo
-.netAddressInfo.WIFI.pwd, netPWD, NET_WIFI_PWD_SIZE-1);
-netInfo.
-connType = (OCConnectivityType) jConnectivityType;
-
-if(netInfo.connType==CT_ADAPTER_GATT_BTLE)
-{
-
-strncpy(netInfo
-.netAddressInfo.LE.leMacAddress,ipAddress,NET_MACADDR_SIZE-1);
-LOGI("MAC set=%s",netInfo.netAddressInfo.LE.leMacAddress);
-
-}
-netInfo.
-isSecured = true;
-
-StartProvisioning(&netInfo);
-
-return;
+ LOGI("JNI JNIProvisionEnrollee: Enter");
+
+ if (!jIPAddress)
+ {
+ LOGE("JNI JNIProvisionEnrollee : jIPAddress is NULL!");
+ return;
+ }
+
+ const char *ipAddress = env->GetStringUTFChars(jIPAddress, NULL);
+ if (NULL == ipAddress)
+ {
+ LOGE("JNI JNIProvisionEnrollee : Failed to convert jstring to char string!");
+ }
+
+ LOGI("JNI JNIProvisionEnrollee : ipAddress is : %s",ipAddress);
+
+ const char *netSSID = env->GetStringUTFChars(jNetSSID, NULL);
+ if (NULL == netSSID)
+ {
+ LOGE("JNI JNIProvisionEnrollee : Failed to convert jstring to char string!");
+ }
+
+ LOGI("JNI JNIProvisionEnrollee : netSSID is : %s",netSSID);
+
+ const char *netPWD = env->GetStringUTFChars(jNetPWD, NULL);
+ if (NULL == netPWD)
+ {
+ LOGE("JNI JNIProvisionEnrollee : Failed to convert jstring to char string!");
+ }
+
+ LOGI("JNI JNIProvisionEnrollee : netPWD is : %s",netPWD);
+
+ OCConnectivityType connecitivityType;
+ EnrolleeNWProvInfo_t netInfo =
+ { 0};
+ strncpy(netInfo
+ .netAddressInfo.WIFI.ipAddress, ipAddress, IPV4_ADDR_SIZE-1);
+ strncpy(netInfo
+ .netAddressInfo.WIFI.ssid, netSSID, NET_WIFI_SSID_SIZE-1);
+ strncpy(netInfo
+ .netAddressInfo.WIFI.pwd, netPWD, NET_WIFI_PWD_SIZE-1);
+ netInfo.
+ connType = (OCConnectivityType) jConnectivityType;
+
+ netInfo.
+ isSecured = true;
+
+ StartProvisioning(&netInfo);
+
+ return;
}
JNIEXPORT void JNICALL
JNIStopEnrolleeProvisioning(JNIEnv
-*env,
-jobject thisObj,
- jint
-jConnectivityType)
+ *env,
+ jobject thisObj,
+ jint
+ jConnectivityType)
{
-LOGI("JNI Stop Easy Setup: Entering");
+ LOGI("JNI Stop Easy Setup: Entering");
-StopProvisioning((OCConnectivityType) jConnectivityType);
+ StopProvisioning((OCConnectivityType)
+ jConnectivityType);
-return;
+ return;
}
+++ /dev/null
-//******************************************************************
-//
-// Copyright 2015 Samsung Electronics All Rights Reserved.
-//
-//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-
-
-// NOTE : Keeping Ble provisioning in this file to have adaptability while doing OOPs refactoring
-
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <signal.h>
-#include <unistd.h>
-#include <pthread.h>
-
-#include "ocpayload.h"
-#include "provisioning.h"
-#include "common.h"
-// External includes
-
-#include "logger.h"
-#include "oic_malloc.h"
-
-static bool sent_provision_request = false;
-
-static EnrolleeNWProvInfo_t *netProvInfo;
-
-/**
- * @var cbData
- * @brief Callback for providing provisioning status callback to application
- */
-static OCProvisioningStatusCB cbData = NULL;
-
-
-OCStackApplicationResult GetProvisioningStatusResponse(void *ctx, OCDoHandle handle,
- OCClientResponse *clientResponse) {
-
- OIC_LOG_V(DEBUG, TAG, "INside GetProvisioningStatusResponse");
-
- // If user stopped the process then return from this function;
- if (IsSetupStopped()) {
- ErrorCallback(DEVICE_NOT_PROVISIONED);
- ClearMemory();
- return OC_STACK_DELETE_TRANSACTION;
- }
-
- if (sent_provision_request == true)
- return OC_STACK_DELETE_TRANSACTION;
- sent_provision_request = true;
-
- ProvisioningInfo *provInfo;
-
- if (!ValidateEnrolleResponse(clientResponse)) {
- ErrorCallback(DEVICE_NOT_PROVISIONED);
- ClearMemory();
- return OC_STACK_DELETE_TRANSACTION;
- }
-
- OCRepPayload *input = (OCRepPayload * )(clientResponse->payload);
-
- char query[OIC_STRING_MAX_VALUE] =
- {'\0'};
- char resURI[MAX_URI_LENGTH] =
- {'\0'};
-
- OIC_LOG_V(DEBUG, TAG, "resUri = %s", input->uri);
-
- strncpy(resURI, input->uri, sizeof(resURI) - 1);
-
- snprintf(query, sizeof(query), UNICAST_PROVISIONING_QUERY_BLE, clientResponse->addr->addr);
-
- OIC_LOG_V(DEBUG, TAG, "query = %s", query);
-
- OCDevAddr *devaddress = &clientResponse->devAddr;
- devaddress->adapter = OC_ADAPTER_GATT_BTLE;
-
- //OCPayloadLogRep(DEBUG,TAG,input);
-
- if (ProvisionEnrollee(OC_HIGH_QOS, query, OC_RSRVD_ES_URI_PROV, devaddress,
- 5 /* 5s delay to avoid packet drop*/) != OC_STACK_OK) {
- OIC_LOG(INFO, TAG,
- "GetProvisioningStatusResponse received NULL clientResponse.Invoking Provisioing Status Callback");
-
- ErrorCallback(DEVICE_NOT_PROVISIONED);
- ClearMemory();
- return OC_STACK_DELETE_TRANSACTION;
- }
-
- return OC_STACK_KEEP_TRANSACTION;
-
-}
-
-OCStackResult GetProvisioningStatus(OCQualityOfService qos, const char *query,
- const OCDevAddr *destination) {
- OCStackResult ret = OC_STACK_ERROR;
- OIC_LOG_V(INFO, TAG, "\n\nExecuting %s %d", __func__, destination->adapter);
- ret = InvokeOCDoResource(query, OC_REST_GET, destination, OC_HIGH_QOS,
- GetProvisioningStatusResponse, NULL, NULL, 0);
- return ret;
-}
-
-
-// This is a function called back when a device is discovered
-OCStackApplicationResult FindProvisioningResourceResponse(void *ctx, OCDoHandle handle,
- OCClientResponse *clientResponse) {
-
- OIC_LOG(INFO, TAG, PCF("Entering FindProvisioningResourceResponse"));
-
- // If user stopped the process then return from this function;
- if (IsSetupStopped()) {
- ErrorCallback(DEVICE_NOT_PROVISIONED);
- ClearMemory();
- return OC_STACK_DELETE_TRANSACTION;
- }
-
- if (!ValidateFinddResourceResponse(clientResponse)) {
- ErrorCallback(DEVICE_NOT_PROVISIONED);
- return OC_STACK_DELETE_TRANSACTION;
- }
-
- OCStackApplicationResult response = OC_STACK_DELETE_TRANSACTION;
-
- ProvisioningInfo *provInfo;
- char szQueryUri[64] =
- {0};
-
- OCDiscoveryPayload *discoveryPayload = (OCDiscoveryPayload * )(clientResponse->payload);
-
- // Need to conform if below check is required or not. As Null check of clientResponse->payload is already performed above
- if (!discoveryPayload) {
- OIC_LOG_V(DEBUG, TAG, "Failed To parse");
- ErrorCallback(DEVICE_NOT_PROVISIONED);
- return OC_STACK_DELETE_TRANSACTION;
- }
-
- OIC_LOG_V(DEBUG, TAG, "resUri = %s", discoveryPayload->resources->uri);
-
- snprintf(szQueryUri, sizeof(szQueryUri), UNICAST_PROVISIONING_QUERY_BLE,
- clientResponse->addr->addr);
-
- OCDevAddr *devaddress = &clientResponse->devAddr;
- devaddress->adapter = OC_ADAPTER_GATT_BTLE;
-
- if (strcmp(netProvInfo->netAddressInfo.WIFI.ipAddress, clientResponse->devAddr.addr))
- OIC_LOG_V(INFO, TAG, "unequal %s %s", netProvInfo->netAddressInfo.WIFI.ipAddress,
- clientResponse->devAddr.addr);
- else
- OIC_LOG_V(INFO, TAG, "unequal %s %s", netProvInfo->netAddressInfo.WIFI.ipAddress,
- clientResponse->devAddr.addr);
-
- OIC_LOG_V(DEBUG, TAG, "query before GetProvisioningStatus call = %s %d", szQueryUri,
- devaddress->adapter);
-
- if (GetProvisioningStatus(OC_HIGH_QOS, szQueryUri, devaddress) != OC_STACK_OK) {
- ErrorCallback(DEVICE_NOT_PROVISIONED);
- return OC_STACK_DELETE_TRANSACTION;
- }
-
- return OC_STACK_KEEP_TRANSACTION;
-
-}
-
-bool ValidateEasySetupParams(const EnrolleeNWProvInfo_t *netInfo,
- OCProvisioningStatusCB provisioningStatusCallback) {
-
- if (netInfo == NULL || strlen(netInfo->netAddressInfo.LE.leMacAddress) == 0) {
- OIC_LOG(ERROR, TAG, "Request URI is NULL");
- return false;
- }
-
- if (provisioningStatusCallback == NULL) {
- OIC_LOG(ERROR, TAG, "ProvisioningStatusCallback is NULL");
- return false;
- }
-
- return true;
-
-}
-
if (netInfo->connType == CT_IP_USE_V4) {
snprintf(findQuery, sizeof(findQuery), UNICAST_PROVISIONING_QUERY,
netInfo->netAddressInfo.WIFI.ipAddress, IP_PORT);
- } else {
-
- snprintf(findQuery, sizeof(findQuery),
- MULTICAST_PROVISIONING_QUERY_BLE);
}
return StartProvisioningProcess(netInfo, cbData, findQuery);