--- /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.
+ *
+ ******************************************************************/
+
+package org.iotivity.ca;
+
+import android.bluetooth.BluetoothAdapter;
+import android.bluetooth.BluetoothDevice;
+import android.content.BroadcastReceiver;
+import android.content.Context;
+import android.content.Intent;
+import android.content.IntentFilter;
+
+public class CaEdrInterface {
+
+ private CaEdrInterface(Context context) {
+
+ registerIntentFilter(context);
+ }
+
+ private static IntentFilter registerIntentFilter(Context context) {
+ IntentFilter filter = new IntentFilter();
+ filter.addAction(BluetoothAdapter.ACTION_STATE_CHANGED);
+ filter.addAction(BluetoothDevice.ACTION_BOND_STATE_CHANGED);
+ context.registerReceiver(mReceiver, filter);
+ return filter;
+ }
+
+ // Network Monitor
+ private native static void caEdrStateChangedCallback(int state);
+
+ private native static void caEdrBondStateChangedCallback(String addr);
+
+ private static final BroadcastReceiver mReceiver = new BroadcastReceiver() {
+
+ @Override
+ public void onReceive(Context context, Intent intent) {
+
+ String action = intent.getAction();
+
+ if (action != null && action.equals(BluetoothAdapter.ACTION_STATE_CHANGED)) {
+
+ int state =
+ intent.getIntExtra(BluetoothAdapter.EXTRA_STATE, BluetoothAdapter.ERROR);
+
+ // STATE_ON:12, STATE_OFF:10
+ if (state == BluetoothAdapter.STATE_ON || state == BluetoothAdapter.STATE_OFF)
+ {
+ caEdrStateChangedCallback(state);
+ }
+ }
+
+ if (action != null && action.equals(BluetoothDevice.ACTION_BOND_STATE_CHANGED)) {
+
+ int bondState = intent.getIntExtra(BluetoothDevice.EXTRA_BOND_STATE,
+ BluetoothDevice.ERROR);
+
+ if (bondState == BluetoothDevice.BOND_NONE) {
+ if ((intent.getIntExtra(BluetoothDevice.EXTRA_PREVIOUS_BOND_STATE,
+ BluetoothDevice.ERROR)
+ == BluetoothDevice.BOND_BONDED)) {
+ BluetoothDevice device
+ = intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE);
+
+ caEdrBondStateChangedCallback(device.getAddress());
+ }
+ }
+ }
+ }
+ };
+}
-/*\r
- * //******************************************************************\r
- * //\r
- * // Copyright 2015 Intel Corporation.\r
- * //\r
- * //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\r
- * //\r
- * // Licensed under the Apache License, Version 2.0 (the "License");\r
- * // you may not use this file except in compliance with the License.\r
- * // You may obtain a copy of the License at\r
- * //\r
- * // http://www.apache.org/licenses/LICENSE-2.0\r
- * //\r
- * // Unless required by applicable law or agreed to in writing, software\r
- * // distributed under the License is distributed on an "AS IS" BASIS,\r
- * // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * // See the License for the specific language governing permissions and\r
- * // limitations under the License.\r
- * //\r
- * //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\r
- */\r
+/******************************************************************\r
+ *\r
+ * Copyright 2014 Samsung Electronics All Rights Reserved.\r
+ *\r
+ *\r
+ *\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ *\r
+ ******************************************************************/\r
\r
package org.iotivity.ca;\r
\r
@Override\r
public void onReceive(Context context, Intent intent) {\r
if (intent.getIntExtra(WifiManager.EXTRA_WIFI_STATE,\r
- WifiManager.WIFI_STATE_UNKNOWN) == WifiManager.WIFI_STATE_DISABLED) {\r
- stateDisabled();\r
+ WifiManager.WIFI_STATE_UNKNOWN) == WifiManager.WIFI_STATE_DISABLED) {\r
+ caIpStateDisabled();\r
} else if (intent.getAction().equals(ConnectivityManager.CONNECTIVITY_ACTION)) {\r
ConnectivityManager manager = (ConnectivityManager)\r
mContext.getSystemService(Context.CONNECTIVITY_SERVICE);\r
NetworkInfo nwInfo = manager.getNetworkInfo(ConnectivityManager.TYPE_WIFI);\r
\r
if(nwInfo.isConnected()) {\r
- stateEnabled();\r
+ caIpStateEnabled();\r
}\r
}\r
}\r
};\r
\r
- private native static void stateEnabled();\r
+ private native static void caIpStateEnabled();\r
\r
- private native static void stateDisabled();\r
-}
\ No newline at end of file
+ private native static void caIpStateDisabled();\r
+}\r
--- /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.
+ *
+ ******************************************************************/
+
+package org.iotivity.ca;
+
+import java.nio.ByteBuffer;
+import java.nio.ByteOrder;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.UUID;
+
+import android.bluetooth.BluetoothAdapter;
+import android.bluetooth.BluetoothDevice;
+import android.bluetooth.BluetoothGatt;
+import android.bluetooth.BluetoothGattCallback;
+import android.bluetooth.BluetoothGattCharacteristic;
+import android.bluetooth.BluetoothGattDescriptor;
+import android.content.BroadcastReceiver;
+import android.content.Context;
+import android.content.Intent;
+import android.content.IntentFilter;
+import android.util.Log;
+
+public class CaLeClientInterface {
+
+ private static String SERVICE_UUID = "713d0000-503e-4c75-ba94-3148f18d941e";
+
+ private CaLeClientInterface(Context context) {
+
+ caLeRegisterLeScanCallback(mLeScanCallback);
+ caLeRegisterGattCallback(mGattCallback);
+
+ registerIntentFilter(context);
+ }
+
+ public static void getLeScanCallback() {
+ caLeRegisterLeScanCallback(mLeScanCallback);
+ }
+
+ public static void getLeGattCallback() {
+ caLeRegisterGattCallback(mGattCallback);
+ }
+
+ private static IntentFilter registerIntentFilter(Context context) {
+ IntentFilter filter = new IntentFilter();
+ filter.addAction(BluetoothAdapter.ACTION_STATE_CHANGED);
+ filter.addAction(BluetoothDevice.ACTION_BOND_STATE_CHANGED);
+ context.registerReceiver(mReceiver, filter);
+ return filter;
+ }
+
+ private native static void caLeRegisterLeScanCallback(BluetoothAdapter.LeScanCallback callback);
+
+ private native static void caLeRegisterGattCallback(BluetoothGattCallback callback);
+
+ // BluetoothAdapter.LeScanCallback
+ private native static void caLeScanCallback(BluetoothDevice device,
+ int rssi, byte[] scanRecord);
+
+ // BluetoothGattCallback
+ private native static void caLeGattConnectionStateChangeCallback(
+ BluetoothGatt gatt, int status, int newState);
+
+ private native static void caLeGattServicesDiscoveredCallback(BluetoothGatt gatt, int status);
+
+ private native static void caLeGattCharacteristicReadCallback(
+ BluetoothGatt gatt, BluetoothGattCharacteristic characteristic,
+ byte[] data, int status);
+
+ private native static void caLeGattCharacteristicWriteCallback(
+ BluetoothGatt gatt, BluetoothGattCharacteristic characteristic,
+ byte[] data, int status);
+
+ private native static void caLeGattCharacteristicChangedCallback(
+ BluetoothGatt gatt, BluetoothGattCharacteristic characteristic, byte[] data);
+
+ private native static void caLeGattDescriptorReadCallback(BluetoothGatt gatt,
+ BluetoothGattDescriptor descriptor,
+ int status);
+
+ private native static void caLeGattDescriptorWriteCallback(BluetoothGatt gatt,
+ BluetoothGattDescriptor descriptor,
+ int status);
+
+ private native static void caLeGattReliableWriteCompletedCallback(BluetoothGatt gatt,
+ int status);
+
+ private native static void caLeGattReadRemoteRssiCallback(BluetoothGatt gatt, int rssi,
+ int status);
+
+ // Network Monitor
+ private native static void caLeStateChangedCallback(int state);
+
+ // bond state
+ private native static void caLeBondStateChangedCallback(String address);
+
+ // Callback
+ private static BluetoothAdapter.LeScanCallback mLeScanCallback =
+ new BluetoothAdapter.LeScanCallback() {
+
+ @Override
+ public void onLeScan(BluetoothDevice device, int rssi, byte[] scanRecord) {
+
+ try {
+ List<UUID> uuids = getUuids(scanRecord);
+ for (UUID uuid : uuids) {
+ Log.d("CA", "UUID : " + uuid.toString());
+ if(uuid.toString().contains(SERVICE_UUID)) {
+ Log.d("CA", "we found that has the Device");
+ caLeScanCallback(device, rssi, scanRecord);
+ }
+ }
+ } catch(UnsatisfiedLinkError e) {
+
+ }
+ }
+ };
+
+ private static List<UUID> getUuids(final byte[] scanRecord) {
+ List<UUID> uuids = new ArrayList<UUID>();
+
+ int offset = 0;
+ while (offset < (scanRecord.length - 2)) {
+ int len = scanRecord[offset++];
+ if (len == 0)
+ break;
+
+ int type = scanRecord[offset++];
+
+ switch (type) {
+ case 0x02:
+ case 0x03:
+ while (len > 1) {
+ int uuid16 = scanRecord[offset++];
+ uuid16 += (scanRecord[offset++] << 8);
+ len -= 2;
+ uuids.add(UUID.fromString(String.format(
+ "%08x-0000-1000-8000-00805f9b34fb", uuid16)));
+ }
+ break;
+ case 0x06:
+ case 0x07:
+ while (len >= 16) {
+ try {
+ ByteBuffer buffer = ByteBuffer.wrap(scanRecord, offset++, 16).
+ order(ByteOrder.LITTLE_ENDIAN);
+ long mostSigBits = buffer.getLong();
+ long leastSigBits = buffer.getLong();
+ uuids.add(new UUID(leastSigBits, mostSigBits));
+ } catch (IndexOutOfBoundsException e) {
+ Log.e("CA", e.toString());
+ continue;
+ } finally {
+ offset += 15;
+ len -= 16;
+ }
+ }
+ break;
+ default:
+ offset += (len - 1);
+ break;
+ }
+ }
+ return uuids;
+ }
+
+ private static final BluetoothGattCallback mGattCallback = new BluetoothGattCallback() {
+
+ @Override
+ public void onConnectionStateChange(BluetoothGatt gatt, int status, int newState) {
+ super.onConnectionStateChange(gatt, status, newState);
+
+ caLeGattConnectionStateChangeCallback(gatt, status, newState);
+ }
+
+ @Override
+ public void onServicesDiscovered(BluetoothGatt gatt, int status) {
+ super.onServicesDiscovered(gatt, status);
+
+ caLeGattServicesDiscoveredCallback(gatt, status);
+ }
+
+ @Override
+ public void onCharacteristicRead(BluetoothGatt gatt,
+ BluetoothGattCharacteristic characteristic, int status) {
+ super.onCharacteristicRead(gatt, characteristic, status);
+
+ caLeGattCharacteristicReadCallback(gatt, characteristic,
+ characteristic.getValue(), status);
+ }
+
+ @Override
+ public void onCharacteristicWrite(BluetoothGatt gatt,
+ BluetoothGattCharacteristic characteristic, int status) {
+ super.onCharacteristicWrite(gatt, characteristic, status);
+
+ caLeGattCharacteristicWriteCallback(gatt, characteristic,
+ characteristic.getValue(), status);
+ }
+
+ @Override
+ public void onCharacteristicChanged(BluetoothGatt gatt,
+ BluetoothGattCharacteristic characteristic) {
+ super.onCharacteristicChanged(gatt, characteristic);
+
+ caLeGattCharacteristicChangedCallback(gatt, characteristic,
+ characteristic.getValue());
+ }
+
+ @Override
+ public void onDescriptorRead(BluetoothGatt gatt, BluetoothGattDescriptor descriptor,
+ int status) {
+ super.onDescriptorRead(gatt, descriptor, status);
+
+ caLeGattDescriptorReadCallback(gatt, descriptor, status);
+ }
+
+ @Override
+ public void onDescriptorWrite(BluetoothGatt gatt, BluetoothGattDescriptor descriptor,
+ int status) {
+ super.onDescriptorWrite(gatt, descriptor, status);
+
+ caLeGattDescriptorWriteCallback(gatt, descriptor, status);
+ }
+
+ @Override
+ public void onReliableWriteCompleted(BluetoothGatt gatt, int status) {
+ super.onReliableWriteCompleted(gatt, status);
+
+ caLeGattReliableWriteCompletedCallback(gatt, status);
+ }
+
+ @Override
+ public void onReadRemoteRssi(BluetoothGatt gatt, int rssi, int status) {
+ super.onReadRemoteRssi(gatt, rssi, status);
+
+ caLeGattReadRemoteRssiCallback(gatt, rssi, status);
+ }
+ };
+
+ private static final BroadcastReceiver mReceiver = new BroadcastReceiver() {
+
+ @Override
+ public void onReceive(Context context, Intent intent) {
+
+ String action = intent.getAction();
+
+ if (action != null && action.equals(BluetoothAdapter.ACTION_STATE_CHANGED)) {
+
+ int state = intent.getIntExtra(BluetoothAdapter.EXTRA_STATE,
+ BluetoothAdapter.ERROR);
+
+ if (state == BluetoothAdapter.STATE_ON || state == BluetoothAdapter.STATE_OFF)
+ {
+ caLeStateChangedCallback(state);
+ }
+ }
+
+ if (action != null && action.equals(BluetoothDevice.ACTION_BOND_STATE_CHANGED)) {
+
+ int bondState = intent.getIntExtra(BluetoothDevice.EXTRA_BOND_STATE,
+ BluetoothDevice.ERROR);
+
+ if (bondState == BluetoothDevice.BOND_NONE) {
+ if ((intent.getIntExtra(BluetoothDevice.EXTRA_PREVIOUS_BOND_STATE,
+ BluetoothDevice.ERROR) == BluetoothDevice.BOND_BONDED)) {
+ BluetoothDevice device = intent
+ .getParcelableExtra(BluetoothDevice.EXTRA_DEVICE);
+
+ caLeBondStateChangedCallback(device.getAddress());
+ }
+ }
+ }
+ }
+ };
+}
+
--- /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.
+ *
+ ******************************************************************/
+
+package org.iotivity.ca;
+
+import java.nio.ByteBuffer;
+import java.nio.ByteOrder;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.UUID;
+
+import android.bluetooth.BluetoothAdapter;
+import android.bluetooth.BluetoothDevice;
+import android.bluetooth.BluetoothGatt;
+import android.bluetooth.BluetoothGattCallback;
+import android.bluetooth.BluetoothGattCharacteristic;
+import android.bluetooth.BluetoothGattDescriptor;
+import android.bluetooth.BluetoothGattServerCallback;
+import android.bluetooth.BluetoothGattService;
+import android.bluetooth.le.AdvertiseCallback;
+import android.bluetooth.le.AdvertiseSettings;
+import android.content.BroadcastReceiver;
+import android.content.Context;
+import android.content.Intent;
+import android.content.IntentFilter;
+import android.util.Log;
+
+public class CaLeServerInterface {
+
+ private CaLeServerInterface() {
+
+ caLeRegisterGattServerCallback(mGattServerCallback);
+ caLeRegisterBluetoothLeAdvertiseCallback(mAdvertiseCallback);
+ }
+
+ public static void getLeGattServerCallback() {
+ caLeRegisterGattServerCallback(mGattServerCallback);
+ }
+
+ public static void getBluetoothLeAdvertiseCallback() {
+ caLeRegisterBluetoothLeAdvertiseCallback(mAdvertiseCallback);
+ }
+
+ private native static void caLeRegisterGattServerCallback(BluetoothGattServerCallback callback);
+
+ private native static void caLeRegisterBluetoothLeAdvertiseCallback(AdvertiseCallback callback);
+
+ // BluetoothGattServerCallback
+ private native static void caLeGattServerConnectionStateChangeCallback(
+ BluetoothDevice device, int status, int newState);
+
+ private native static void caLeGattServerServiceAddedCallback(int status,
+ BluetoothGattService service);
+
+ private native static void caLeGattServerCharacteristicReadRequestCallback(
+ BluetoothDevice device,
+ int requestId, int offset, BluetoothGattCharacteristic characteristic, byte[] data);
+
+ private native static void caLeGattServerCharacteristicWriteRequestCallback(
+ BluetoothDevice device, int requestId,
+ BluetoothGattCharacteristic characteristic, byte[] data, boolean preparedWrite,
+ boolean responseNeeded, int offset, byte[] value);
+
+ private native static void caLeGattServerDescriptorReadRequestCallback(
+ BluetoothDevice device, int requestId, int offset, BluetoothGattDescriptor descriptor);
+
+ public native static void caLeGattServerDescriptorWriteRequestCallback(
+ BluetoothDevice device, int requestId, BluetoothGattDescriptor descriptor,
+ boolean preparedWrite, boolean responseNeeded, int offset, byte[] value);
+
+ private native static void caLeGattServerExecuteWriteCallback(BluetoothDevice device,
+ int requestId, boolean execute);
+
+ private native static void caLeGattServerNotificationSentCallback(BluetoothDevice device,
+ int status);
+
+ // AdvertiseCallback
+ private native static void caLeAdvertiseStartSuccessCallback(
+ AdvertiseSettings settingsInEffect);
+
+ private native static void caLeAdvertiseStartFailureCallback(int errorCode);
+
+ private static final BluetoothGattServerCallback mGattServerCallback =
+ new BluetoothGattServerCallback() {
+
+ @Override
+ public void onConnectionStateChange(BluetoothDevice device, int status,
+ int newState) {
+ super.onConnectionStateChange(device, status, newState);
+
+ caLeGattServerConnectionStateChangeCallback(device, status, newState);
+ }
+
+ @Override
+ public void onServiceAdded(int status, BluetoothGattService service) {
+ super.onServiceAdded(status, service);
+
+ caLeGattServerServiceAddedCallback(status, service);
+ }
+
+ @Override
+ public void onCharacteristicReadRequest(
+ BluetoothDevice device, int requestId, int offset,
+ BluetoothGattCharacteristic characteristic) {
+ super.onCharacteristicReadRequest(device, requestId, offset, characteristic);
+
+ caLeGattServerCharacteristicReadRequestCallback(device, requestId, offset,
+ characteristic,
+ characteristic.getValue());
+ }
+
+ @Override
+ public void onCharacteristicWriteRequest(
+ BluetoothDevice device, int requestId, BluetoothGattCharacteristic characteristic,
+ boolean preparedWrite, boolean responseNeeded, int offset, byte[] value) {
+ super.onCharacteristicWriteRequest(device, requestId, characteristic,
+ preparedWrite, responseNeeded, offset, value);
+
+ caLeGattServerCharacteristicWriteRequestCallback(device, requestId, characteristic,
+ value, preparedWrite, responseNeeded,
+ offset, value);
+ }
+
+ @Override
+ public void onDescriptorReadRequest(
+ BluetoothDevice device,
+ int requestId, int offset, BluetoothGattDescriptor descriptor) {
+ super.onDescriptorReadRequest(device, requestId, offset, descriptor);
+
+ caLeGattServerDescriptorReadRequestCallback(device, requestId, offset, descriptor);
+ }
+
+ @Override
+ public void onDescriptorWriteRequest(
+ BluetoothDevice device, int requestId, BluetoothGattDescriptor descriptor,
+ boolean preparedWrite, boolean responseNeeded, int offset,
+ byte[] value) {
+ super.onDescriptorWriteRequest(device, requestId, descriptor, preparedWrite,
+ responseNeeded, offset, value);
+
+ caLeGattServerDescriptorWriteRequestCallback(device, requestId, descriptor,
+ preparedWrite, responseNeeded, offset,
+ value);
+ }
+
+ @Override
+ public void onExecuteWrite(BluetoothDevice device, int requestId, boolean execute) {
+ super.onExecuteWrite(device, requestId, execute);
+
+ caLeGattServerExecuteWriteCallback(device, requestId, execute);
+ }
+
+ @Override
+ public void onNotificationSent(BluetoothDevice device, int status) {
+ super.onNotificationSent(device, status);
+
+ caLeGattServerNotificationSentCallback(device, status);
+ }
+ };
+
+ private static final AdvertiseCallback mAdvertiseCallback = new AdvertiseCallback() {
+
+ @Override
+ public void onStartSuccess(AdvertiseSettings settingsInEffect) {
+ super.onStartSuccess(settingsInEffect);
+
+ caLeAdvertiseStartSuccessCallback(settingsInEffect);
+ }
+
+ @Override
+ public void onStartFailure(int errorCode) {
+ super.onStartFailure(errorCode);
+
+ caLeAdvertiseStartFailureCallback(errorCode);
+ }
+ };
+}
+
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
- package="org.iotivity.sample_service"
+ package="org.iotivity.ca.sample_service"
android:versionCode="1"
android:versionName="1.0" >
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
- android:name="org.iotivity.service.MainActivity"
+ android:name="org.iotivity.ca.service.MainActivity"
android:label="@string/app_name"
android:windowSoftInputMode="stateHidden" >
<intent-filter>
#include "cainterface.h"
#include "cacommon.h"
-#include "org_iotivity_service_RMInterface.h"
+#include "org_iotivity_ca_service_RMInterface.h"
#define LOG_TAG "JNI_INTERFACE_SAMPLE"
#define LOGI(...) __android_log_print(ANDROID_LOG_INFO, LOG_TAG, __VA_ARGS__)
// init
JNIEXPORT void JNICALL
-Java_org_iotivity_service_RMInterface_setNativeResponseListener(JNIEnv *env, jobject obj,
+Java_org_iotivity_ca_service_RMInterface_setNativeResponseListener(JNIEnv *env, jobject obj,
jobject listener)
{
LOGI("setNativeResponseListener");
}
JNIEXPORT void JNICALL
-Java_org_iotivity_service_RMInterface_RMInitialize(JNIEnv *env, jobject obj, jobject context)
+Java_org_iotivity_ca_service_RMInterface_RMInitialize(JNIEnv *env, jobject obj, jobject context)
{
LOGI("RMInitialize");
}
JNIEXPORT void JNICALL
-Java_org_iotivity_service_RMInterface_RMTerminate(JNIEnv *env, jobject obj)
+Java_org_iotivity_ca_service_RMInterface_RMTerminate(JNIEnv *env, jobject obj)
{
LOGI("RMTerminate");
CADestroyToken(g_lastRequestToken);
}
JNIEXPORT void JNICALL
-Java_org_iotivity_service_RMInterface_RMStartListeningServer(JNIEnv *env, jobject obj)
+Java_org_iotivity_ca_service_RMInterface_RMStartListeningServer(JNIEnv *env, jobject obj)
{
LOGI("RMStartListeningServer");
}
JNIEXPORT void JNICALL
-Java_org_iotivity_service_RMInterface_RMStartDiscoveryServer(JNIEnv *env, jobject obj)
+Java_org_iotivity_ca_service_RMInterface_RMStartDiscoveryServer(JNIEnv *env, jobject obj)
{
LOGI("RMStartDiscoveryServer");
}
JNIEXPORT void JNICALL
-Java_org_iotivity_service_RMInterface_RMRegisterHandler(JNIEnv *env, jobject obj)
+Java_org_iotivity_ca_service_RMInterface_RMRegisterHandler(JNIEnv *env, jobject obj)
{
LOGI("RMRegisterHandler");
}
JNIEXPORT void JNICALL
-Java_org_iotivity_service_RMInterface_RMFindResource(JNIEnv *env, jobject obj, jstring uri)
+Java_org_iotivity_ca_service_RMInterface_RMFindResource(JNIEnv *env, jobject obj, jstring uri)
{
// create token
CAToken_t token = NULL;
}
JNIEXPORT void JNICALL
-Java_org_iotivity_service_RMInterface_RMSendRequest(JNIEnv *env, jobject obj, jstring uri,
+Java_org_iotivity_ca_service_RMInterface_RMSendRequest(JNIEnv *env, jobject obj, jstring uri,
jstring payload, jint selectedNetwork,
jint isSecured, jint msgType)
{
}
JNIEXPORT void JNICALL
-Java_org_iotivity_service_RMInterface_RMSendReqestToAll(JNIEnv *env, jobject obj, jstring uri,
+Java_org_iotivity_ca_service_RMInterface_RMSendReqestToAll(JNIEnv *env, jobject obj, jstring uri,
jint selectedNetwork)
{
LOGI("selectedNetwork - %d", selectedNetwork);
}
JNIEXPORT void JNICALL
-Java_org_iotivity_service_RMInterface_RMSendResponse(JNIEnv *env, jobject obj,
+Java_org_iotivity_ca_service_RMInterface_RMSendResponse(JNIEnv *env, jobject obj,
jint selectedNetwork,
jint isSecured, jint msgType,
jint responseValue)
}
JNIEXPORT void JNICALL
-Java_org_iotivity_service_RMInterface_RMAdvertiseResource(JNIEnv *env, jobject obj, jstring uri)
+Java_org_iotivity_ca_service_RMInterface_RMAdvertiseResource(JNIEnv *env, jobject obj, jstring uri)
{
LOGI("RMAdvertiseResource");
}
JNIEXPORT void JNICALL
-Java_org_iotivity_service_RMInterface_RMSendNotification(JNIEnv *env, jobject obj, jstring uri,
+Java_org_iotivity_ca_service_RMInterface_RMSendNotification(JNIEnv *env, jobject obj, jstring uri,
jstring payload, jint selectedNetwork,
jint isSecured, jint msgType,
jint responseValue)
}
JNIEXPORT void JNICALL
-Java_org_iotivity_service_RMInterface_RMSelectNetwork(JNIEnv *env, jobject obj, jint networkType)
+Java_org_iotivity_ca_service_RMInterface_RMSelectNetwork(JNIEnv *env, jobject obj, jint networkType)
{
LOGI("RMSelectNetwork Type : %d", networkType);
}
JNIEXPORT void JNICALL
-Java_org_iotivity_service_RMInterface_RMUnSelectNetwork(JNIEnv *env, jobject obj, jint networkType)
+Java_org_iotivity_ca_service_RMInterface_RMUnSelectNetwork(JNIEnv *env, jobject obj, jint networkType)
{
LOGI("RMUnSelectNetwork Type : %d", networkType);
}
JNIEXPORT void JNICALL
-Java_org_iotivity_service_RMInterface_RMGetNetworkInfomation(JNIEnv *env, jobject obj)
+Java_org_iotivity_ca_service_RMInterface_RMGetNetworkInfomation(JNIEnv *env, jobject obj)
{
LOGI("RMGetNetworkInfomation");
}
JNIEXPORT void JNICALL
-Java_org_iotivity_service_RMInterface_RMHandleRequestResponse(JNIEnv *env, jobject obj)
+Java_org_iotivity_ca_service_RMInterface_RMHandleRequestResponse(JNIEnv *env, jobject obj)
{
LOGI("RMHandleRequestResponse");
--- /dev/null
+#include <jni.h>
+/* Header for class org_iotivity_ca_service_RMInterface */
+
+#ifndef _Included_org_iotivity_ca_service_RMInterface
+#define _Included_org_iotivity_ca_service_RMInterface
+#ifdef __cplusplus
+extern "C" {
+#endif
+JNIEXPORT void JNICALL Java_org_iotivity_ca_service_RMInterface_setNativeResponseListener
+ (JNIEnv *, jobject, jobject);
+/*
+ * Class: org_iotivity_ca_service_RMInterface
+ * Method: RMInitialize
+ * Signature: (Landroid/content/Context;)V
+ */
+JNIEXPORT void JNICALL Java_org_iotivity_ca_service_RMInterface_RMInitialize
+ (JNIEnv *, jobject, jobject);
+
+/*
+ * Class: org_iotivity_ca_service_RMInterface
+ * Method: RMTerminate
+ * Signature: ()V
+ */
+JNIEXPORT void JNICALL Java_org_iotivity_ca_service_RMInterface_RMTerminate
+ (JNIEnv *, jobject);
+
+/*
+ * Class: org_iotivity_ca_service_RMInterface
+ * Method: RMStartListeningServer
+ * Signature: ()V
+ */
+JNIEXPORT void JNICALL Java_org_iotivity_ca_service_RMInterface_RMStartListeningServer
+ (JNIEnv *, jobject);
+
+/*
+ * Class: org_iotivity_ca_service_RMInterface
+ * Method: RMStartDiscoveryServer
+ * Signature: ()V
+ */
+JNIEXPORT void JNICALL Java_org_iotivity_ca_service_RMInterface_RMStartDiscoveryServer
+ (JNIEnv *, jobject);
+
+/*
+ * Class: org_iotivity_ca_service_RMInterface
+ * Method: RMRegisterHandler
+ * Signature: ()V
+ */
+JNIEXPORT void JNICALL Java_org_iotivity_ca_service_RMInterface_RMRegisterHandler
+ (JNIEnv *, jobject);
+
+/*
+ * Class: org_iotivity_ca_service_RMInterface
+ * Method: RMFindResource
+ * Signature: (Ljava/lang/String;)V
+ */
+JNIEXPORT void JNICALL Java_org_iotivity_ca_service_RMInterface_RMFindResource
+ (JNIEnv *, jobject, jstring);
+
+/*
+ * Class: org_iotivity_ca_service_RMInterface
+ * Method: RMSendRequest
+ * Signature: (Ljava/lang/String;Ljava/lang/String;III)V
+ */
+JNIEXPORT void JNICALL Java_org_iotivity_ca_service_RMInterface_RMSendRequest
+ (JNIEnv *, jobject, jstring, jstring, jint, jint, jint);
+
+/*
+ * Class: org_iotivity_ca_service_RMInterface
+ * Method: RMSendReqestToAll
+ * Signature: (Ljava/lang/String;I)V
+ */
+JNIEXPORT void JNICALL Java_org_iotivity_ca_service_RMInterface_RMSendReqestToAll
+ (JNIEnv *, jobject, jstring, jint);
+
+/*
+ * Class: org_iotivity_ca_service_RMInterface
+ * Method: RMSendResponse
+ * Signature: (IIII)V
+ */
+JNIEXPORT void JNICALL Java_org_iotivity_ca_service_RMInterface_RMSendResponse
+ (JNIEnv *, jobject, jint, jint, jint, jint);
+
+/*
+ * Class: org_iotivity_ca_service_RMInterface
+ * Method: RMAdvertiseResource
+ * Signature: (Ljava/lang/String)V
+ */
+JNIEXPORT void JNICALL Java_org_iotivity_ca_service_RMInterface_RMAdvertiseResource
+ (JNIEnv *, jobject, jstring);
+
+/*
+ * Class: org_iotivity_ca_service_RMInterface
+ * Method: RMSendNotification
+ * Signature: (Ljava/lang/String;Ljava/lang/String;IIII)V
+ */
+JNIEXPORT void JNICALL Java_org_iotivity_ca_service_RMInterface_RMSendNotification
+ (JNIEnv *, jobject, jstring, jstring, jint, jint, jint, jint);
+
+/*
+ * Class: org_iotivity_ca_service_RMInterface
+ * Method: RMSelectNetwork
+ * Signature: (I)V
+ */
+JNIEXPORT void JNICALL Java_org_iotivity_ca_service_RMInterface_RMSelectNetwork
+ (JNIEnv *, jobject, jint);
+
+/*
+ * Class: org_iotivity_ca_service_RMInterface
+ * Method: RMUnSelectNetwork
+ * Signature: (I)V
+ */
+JNIEXPORT void JNICALL Java_org_iotivity_ca_service_RMInterface_RMUnSelectNetwork
+ (JNIEnv *, jobject, jint);
+
+/*
+ * Class: org_iotivity_ca_service_RMInterface
+ * Method: RMGetNetworkInfomation
+ * Signature: ()V
+ */
+JNIEXPORT void JNICALL Java_org_iotivity_ca_service_RMInterface_RMGetNetworkInfomation
+ (JNIEnv *, jobject);
+
+/*
+ * Class: org_iotivity_ca_service_RMInterface
+ * Method: RMHandleRequestResponse
+ * Signature: ()V
+ */
+JNIEXPORT void JNICALL Java_org_iotivity_ca_service_RMInterface_RMHandleRequestResponse
+ (JNIEnv *, jobject);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
+++ /dev/null
-#include <jni.h>
-/* Header for class org_iotivity_service_RMInterface */
-
-#ifndef _Included_org_iotivity_service_RMInterface
-#define _Included_org_iotivity_service_RMInterface
-#ifdef __cplusplus
-extern "C" {
-#endif
-JNIEXPORT void JNICALL Java_org_iotivity_service_RMInterface_setNativeResponseListener
- (JNIEnv *, jobject, jobject);
-/*
- * Class: org_iotivity_service_RMInterface
- * Method: RMInitialize
- * Signature: (Landroid/content/Context;)V
- */
-JNIEXPORT void JNICALL Java_org_iotivity_service_RMInterface_RMInitialize
- (JNIEnv *, jobject, jobject);
-
-/*
- * Class: org_iotivity_service_RMInterface
- * Method: RMTerminate
- * Signature: ()V
- */
-JNIEXPORT void JNICALL Java_org_iotivity_service_RMInterface_RMTerminate
- (JNIEnv *, jobject);
-
-/*
- * Class: org_iotivity_service_RMInterface
- * Method: RMStartListeningServer
- * Signature: ()V
- */
-JNIEXPORT void JNICALL Java_org_iotivity_service_RMInterface_RMStartListeningServer
- (JNIEnv *, jobject);
-
-/*
- * Class: org_iotivity_service_RMInterface
- * Method: RMStartDiscoveryServer
- * Signature: ()V
- */
-JNIEXPORT void JNICALL Java_org_iotivity_service_RMInterface_RMStartDiscoveryServer
- (JNIEnv *, jobject);
-
-/*
- * Class: org_iotivity_service_RMInterface
- * Method: RMRegisterHandler
- * Signature: ()V
- */
-JNIEXPORT void JNICALL Java_org_iotivity_service_RMInterface_RMRegisterHandler
- (JNIEnv *, jobject);
-
-/*
- * Class: org_iotivity_service_RMInterface
- * Method: RMFindResource
- * Signature: (Ljava/lang/String;)V
- */
-JNIEXPORT void JNICALL Java_org_iotivity_service_RMInterface_RMFindResource
- (JNIEnv *, jobject, jstring);
-
-/*
- * Class: org_iotivity_service_RMInterface
- * Method: RMSendRequest
- * Signature: (Ljava/lang/String;Ljava/lang/String;III)V
- */
-JNIEXPORT void JNICALL Java_org_iotivity_service_RMInterface_RMSendRequest
- (JNIEnv *, jobject, jstring, jstring, jint, jint, jint);
-
-/*
- * Class: org_iotivity_service_RMInterface
- * Method: RMSendReqestToAll
- * Signature: (Ljava/lang/String;I)V
- */
-JNIEXPORT void JNICALL Java_org_iotivity_service_RMInterface_RMSendReqestToAll
- (JNIEnv *, jobject, jstring, jint);
-
-/*
- * Class: org_iotivity_service_RMInterface
- * Method: RMSendResponse
- * Signature: (IIII)V
- */
-JNIEXPORT void JNICALL Java_org_iotivity_service_RMInterface_RMSendResponse
- (JNIEnv *, jobject, jint, jint, jint, jint);
-
-/*
- * Class: org_iotivity_service_RMInterface
- * Method: RMAdvertiseResource
- * Signature: (Ljava/lang/String)V
- */
-JNIEXPORT void JNICALL Java_org_iotivity_service_RMInterface_RMAdvertiseResource
- (JNIEnv *, jobject, jstring);
-
-/*
- * Class: org_iotivity_service_RMInterface
- * Method: RMSendNotification
- * Signature: (Ljava/lang/String;Ljava/lang/String;IIII)V
- */
-JNIEXPORT void JNICALL Java_org_iotivity_service_RMInterface_RMSendNotification
- (JNIEnv *, jobject, jstring, jstring, jint, jint, jint, jint);
-
-/*
- * Class: org_iotivity_service_RMInterface
- * Method: RMSelectNetwork
- * Signature: (I)V
- */
-JNIEXPORT void JNICALL Java_org_iotivity_service_RMInterface_RMSelectNetwork
- (JNIEnv *, jobject, jint);
-
-/*
- * Class: org_iotivity_service_RMInterface
- * Method: RMUnSelectNetwork
- * Signature: (I)V
- */
-JNIEXPORT void JNICALL Java_org_iotivity_service_RMInterface_RMUnSelectNetwork
- (JNIEnv *, jobject, jint);
-
-/*
- * Class: org_iotivity_service_RMInterface
- * Method: RMGetNetworkInfomation
- * Signature: ()V
- */
-JNIEXPORT void JNICALL Java_org_iotivity_service_RMInterface_RMGetNetworkInfomation
- (JNIEnv *, jobject);
-
-/*
- * Class: org_iotivity_service_RMInterface
- * Method: RMHandleRequestResponse
- * Signature: ()V
- */
-JNIEXPORT void JNICALL Java_org_iotivity_service_RMInterface_RMHandleRequestResponse
- (JNIEnv *, jobject);
-
-#ifdef __cplusplus
-}
-#endif
-#endif
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
- tools:context="org.iotivity.service.MainActivity" >
+ tools:context="org.iotivity.ca.service.MainActivity" >
<RelativeLayout
android:id="@+id/sample_service_layout"
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
- tools:context="org.iotivity.sample_service.MainActivity" >
+ tools:context="org.iotivity.ca.sample_service.MainActivity" >
<item
android:id="@+id/action_settings"
--- /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.
+ *
+ ******************************************************************/
+
+package org.iotivity.ca;
+
+import android.bluetooth.BluetoothAdapter;
+import android.bluetooth.BluetoothDevice;
+import android.content.BroadcastReceiver;
+import android.content.Context;
+import android.content.Intent;
+import android.content.IntentFilter;
+
+public class CaEdrInterface {
+
+ private CaEdrInterface(Context context) {
+
+ registerIntentFilter(context);
+ }
+
+ private static IntentFilter registerIntentFilter(Context context) {
+ IntentFilter filter = new IntentFilter();
+ filter.addAction(BluetoothAdapter.ACTION_STATE_CHANGED);
+ filter.addAction(BluetoothDevice.ACTION_BOND_STATE_CHANGED);
+ context.registerReceiver(mReceiver, filter);
+ return filter;
+ }
+
+ // Network Monitor
+ private native static void caEdrStateChangedCallback(int state);
+
+ private native static void caEdrBondStateChangedCallback(String addr);
+
+ private static final BroadcastReceiver mReceiver = new BroadcastReceiver() {
+
+ @Override
+ public void onReceive(Context context, Intent intent) {
+
+ String action = intent.getAction();
+
+ if (action != null && action.equals(BluetoothAdapter.ACTION_STATE_CHANGED)) {
+
+ int state =
+ intent.getIntExtra(BluetoothAdapter.EXTRA_STATE, BluetoothAdapter.ERROR);
+
+ // STATE_ON:12, STATE_OFF:10
+ if (state == BluetoothAdapter.STATE_ON || state == BluetoothAdapter.STATE_OFF)
+ {
+ caEdrStateChangedCallback(state);
+ }
+ }
+
+ if (action != null && action.equals(BluetoothDevice.ACTION_BOND_STATE_CHANGED)) {
+
+ int bondState = intent.getIntExtra(BluetoothDevice.EXTRA_BOND_STATE,
+ BluetoothDevice.ERROR);
+
+ if (bondState == BluetoothDevice.BOND_NONE) {
+ if ((intent.getIntExtra(BluetoothDevice.EXTRA_PREVIOUS_BOND_STATE,
+ BluetoothDevice.ERROR)
+ == BluetoothDevice.BOND_BONDED)) {
+ BluetoothDevice device
+ = intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE);
+
+ caEdrBondStateChangedCallback(device.getAddress());
+ }
+ }
+ }
+ }
+ };
+}
-/*\r
- * //******************************************************************\r
- * //\r
- * // Copyright 2015 Intel Corporation.\r
- * //\r
- * //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\r
- * //\r
- * // Licensed under the Apache License, Version 2.0 (the "License");\r
- * // you may not use this file except in compliance with the License.\r
- * // You may obtain a copy of the License at\r
- * //\r
- * // http://www.apache.org/licenses/LICENSE-2.0\r
- * //\r
- * // Unless required by applicable law or agreed to in writing, software\r
- * // distributed under the License is distributed on an "AS IS" BASIS,\r
- * // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * // See the License for the specific language governing permissions and\r
- * // limitations under the License.\r
- * //\r
- * //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\r
- */\r
+/******************************************************************\r
+ *\r
+ * Copyright 2014 Samsung Electronics All Rights Reserved.\r
+ *\r
+ *\r
+ *\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ *\r
+ ******************************************************************/\r
\r
package org.iotivity.ca;\r
\r
@Override\r
public void onReceive(Context context, Intent intent) {\r
if (intent.getIntExtra(WifiManager.EXTRA_WIFI_STATE,\r
- WifiManager.WIFI_STATE_UNKNOWN) == WifiManager.WIFI_STATE_DISABLED) {\r
- stateDisabled();\r
+ WifiManager.WIFI_STATE_UNKNOWN) == WifiManager.WIFI_STATE_DISABLED) {\r
+ caIpStateDisabled();\r
} else if (intent.getAction().equals(ConnectivityManager.CONNECTIVITY_ACTION)) {\r
ConnectivityManager manager = (ConnectivityManager)\r
mContext.getSystemService(Context.CONNECTIVITY_SERVICE);\r
NetworkInfo nwInfo = manager.getNetworkInfo(ConnectivityManager.TYPE_WIFI);\r
\r
if(nwInfo.isConnected()) {\r
- stateEnabled();\r
+ caIpStateEnabled();\r
}\r
}\r
}\r
};\r
\r
- private native static void stateEnabled();\r
+ private native static void caIpStateEnabled();\r
\r
- private native static void stateDisabled();\r
+ private native static void caIpStateDisabled();\r
}
\ No newline at end of file
--- /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.
+ *
+ ******************************************************************/
+
+package org.iotivity.ca;
+
+import java.nio.ByteBuffer;
+import java.nio.ByteOrder;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.UUID;
+
+import android.bluetooth.BluetoothAdapter;
+import android.bluetooth.BluetoothDevice;
+import android.bluetooth.BluetoothGatt;
+import android.bluetooth.BluetoothGattCallback;
+import android.bluetooth.BluetoothGattCharacteristic;
+import android.bluetooth.BluetoothGattDescriptor;
+import android.content.BroadcastReceiver;
+import android.content.Context;
+import android.content.Intent;
+import android.content.IntentFilter;
+import android.util.Log;
+
+public class CaLeClientInterface {
+
+ private static String SERVICE_UUID = "713d0000-503e-4c75-ba94-3148f18d941e";
+
+ private CaLeClientInterface(Context context) {
+
+ caLeRegisterLeScanCallback(mLeScanCallback);
+ caLeRegisterGattCallback(mGattCallback);
+
+ registerIntentFilter(context);
+ }
+
+ public static void getLeScanCallback() {
+ caLeRegisterLeScanCallback(mLeScanCallback);
+ }
+
+ public static void getLeGattCallback() {
+ caLeRegisterGattCallback(mGattCallback);
+ }
+
+ private static IntentFilter registerIntentFilter(Context context) {
+ IntentFilter filter = new IntentFilter();
+ filter.addAction(BluetoothAdapter.ACTION_STATE_CHANGED);
+ filter.addAction(BluetoothDevice.ACTION_BOND_STATE_CHANGED);
+ context.registerReceiver(mReceiver, filter);
+ return filter;
+ }
+
+ private native static void caLeRegisterLeScanCallback(BluetoothAdapter.LeScanCallback callback);
+
+ private native static void caLeRegisterGattCallback(BluetoothGattCallback callback);
+
+ // BluetoothAdapter.LeScanCallback
+ private native static void caLeScanCallback(BluetoothDevice device,
+ int rssi, byte[] scanRecord);
+
+ // BluetoothGattCallback
+ private native static void caLeGattConnectionStateChangeCallback(
+ BluetoothGatt gatt, int status, int newState);
+
+ private native static void caLeGattServicesDiscoveredCallback(BluetoothGatt gatt, int status);
+
+ private native static void caLeGattCharacteristicReadCallback(
+ BluetoothGatt gatt, BluetoothGattCharacteristic characteristic,
+ byte[] data, int status);
+
+ private native static void caLeGattCharacteristicWriteCallback(
+ BluetoothGatt gatt, BluetoothGattCharacteristic characteristic,
+ byte[] data, int status);
+
+ private native static void caLeGattCharacteristicChangedCallback(
+ BluetoothGatt gatt, BluetoothGattCharacteristic characteristic, byte[] data);
+
+ private native static void caLeGattDescriptorReadCallback(BluetoothGatt gatt,
+ BluetoothGattDescriptor descriptor,
+ int status);
+
+ private native static void caLeGattDescriptorWriteCallback(BluetoothGatt gatt,
+ BluetoothGattDescriptor descriptor,
+ int status);
+
+ private native static void caLeGattReliableWriteCompletedCallback(BluetoothGatt gatt,
+ int status);
+
+ private native static void caLeGattReadRemoteRssiCallback(BluetoothGatt gatt, int rssi,
+ int status);
+
+ // Network Monitor
+ private native static void caLeStateChangedCallback(int state);
+
+ // bond state
+ private native static void caLeBondStateChangedCallback(String address);
+
+ // Callback
+ private static BluetoothAdapter.LeScanCallback mLeScanCallback =
+ new BluetoothAdapter.LeScanCallback() {
+
+ @Override
+ public void onLeScan(BluetoothDevice device, int rssi, byte[] scanRecord) {
+
+ try {
+ List<UUID> uuids = getUuids(scanRecord);
+ for (UUID uuid : uuids) {
+ Log.d("CA", "UUID : " + uuid.toString());
+ if(uuid.toString().contains(SERVICE_UUID)) {
+ Log.d("CA", "we found that has the Device");
+ caLeScanCallback(device, rssi, scanRecord);
+ }
+ }
+ } catch(UnsatisfiedLinkError e) {
+
+ }
+ }
+ };
+
+ private static List<UUID> getUuids(final byte[] scanRecord) {
+ List<UUID> uuids = new ArrayList<UUID>();
+
+ int offset = 0;
+ while (offset < (scanRecord.length - 2)) {
+ int len = scanRecord[offset++];
+ if (len == 0)
+ break;
+
+ int type = scanRecord[offset++];
+
+ switch (type) {
+ case 0x02:
+ case 0x03:
+ while (len > 1) {
+ int uuid16 = scanRecord[offset++];
+ uuid16 += (scanRecord[offset++] << 8);
+ len -= 2;
+ uuids.add(UUID.fromString(String.format(
+ "%08x-0000-1000-8000-00805f9b34fb", uuid16)));
+ }
+ break;
+ case 0x06:
+ case 0x07:
+ while (len >= 16) {
+ try {
+ ByteBuffer buffer = ByteBuffer.wrap(scanRecord, offset++, 16).
+ order(ByteOrder.LITTLE_ENDIAN);
+ long mostSigBits = buffer.getLong();
+ long leastSigBits = buffer.getLong();
+ uuids.add(new UUID(leastSigBits, mostSigBits));
+ } catch (IndexOutOfBoundsException e) {
+ Log.e("CA", e.toString());
+ continue;
+ } finally {
+ offset += 15;
+ len -= 16;
+ }
+ }
+ break;
+ default:
+ offset += (len - 1);
+ break;
+ }
+ }
+ return uuids;
+ }
+
+ private static final BluetoothGattCallback mGattCallback = new BluetoothGattCallback() {
+
+ @Override
+ public void onConnectionStateChange(BluetoothGatt gatt, int status, int newState) {
+ super.onConnectionStateChange(gatt, status, newState);
+
+ caLeGattConnectionStateChangeCallback(gatt, status, newState);
+ }
+
+ @Override
+ public void onServicesDiscovered(BluetoothGatt gatt, int status) {
+ super.onServicesDiscovered(gatt, status);
+
+ caLeGattServicesDiscoveredCallback(gatt, status);
+ }
+
+ @Override
+ public void onCharacteristicRead(BluetoothGatt gatt,
+ BluetoothGattCharacteristic characteristic, int status) {
+ super.onCharacteristicRead(gatt, characteristic, status);
+
+ caLeGattCharacteristicReadCallback(gatt, characteristic,
+ characteristic.getValue(), status);
+ }
+
+ @Override
+ public void onCharacteristicWrite(BluetoothGatt gatt,
+ BluetoothGattCharacteristic characteristic, int status) {
+ super.onCharacteristicWrite(gatt, characteristic, status);
+
+ caLeGattCharacteristicWriteCallback(gatt, characteristic,
+ characteristic.getValue(), status);
+ }
+
+ @Override
+ public void onCharacteristicChanged(BluetoothGatt gatt,
+ BluetoothGattCharacteristic characteristic) {
+ super.onCharacteristicChanged(gatt, characteristic);
+
+ caLeGattCharacteristicChangedCallback(gatt, characteristic,
+ characteristic.getValue());
+ }
+
+ @Override
+ public void onDescriptorRead(BluetoothGatt gatt, BluetoothGattDescriptor descriptor,
+ int status) {
+ super.onDescriptorRead(gatt, descriptor, status);
+
+ caLeGattDescriptorReadCallback(gatt, descriptor, status);
+ }
+
+ @Override
+ public void onDescriptorWrite(BluetoothGatt gatt, BluetoothGattDescriptor descriptor,
+ int status) {
+ super.onDescriptorWrite(gatt, descriptor, status);
+
+ caLeGattDescriptorWriteCallback(gatt, descriptor, status);
+ }
+
+ @Override
+ public void onReliableWriteCompleted(BluetoothGatt gatt, int status) {
+ super.onReliableWriteCompleted(gatt, status);
+
+ caLeGattReliableWriteCompletedCallback(gatt, status);
+ }
+
+ @Override
+ public void onReadRemoteRssi(BluetoothGatt gatt, int rssi, int status) {
+ super.onReadRemoteRssi(gatt, rssi, status);
+
+ caLeGattReadRemoteRssiCallback(gatt, rssi, status);
+ }
+ };
+
+ private static final BroadcastReceiver mReceiver = new BroadcastReceiver() {
+
+ @Override
+ public void onReceive(Context context, Intent intent) {
+
+ String action = intent.getAction();
+
+ if (action != null && action.equals(BluetoothAdapter.ACTION_STATE_CHANGED)) {
+
+ int state = intent.getIntExtra(BluetoothAdapter.EXTRA_STATE,
+ BluetoothAdapter.ERROR);
+
+ if (state == BluetoothAdapter.STATE_ON || state == BluetoothAdapter.STATE_OFF)
+ {
+ caLeStateChangedCallback(state);
+ }
+ }
+
+ if (action != null && action.equals(BluetoothDevice.ACTION_BOND_STATE_CHANGED)) {
+
+ int bondState = intent.getIntExtra(BluetoothDevice.EXTRA_BOND_STATE,
+ BluetoothDevice.ERROR);
+
+ if (bondState == BluetoothDevice.BOND_NONE) {
+ if ((intent.getIntExtra(BluetoothDevice.EXTRA_PREVIOUS_BOND_STATE,
+ BluetoothDevice.ERROR) == BluetoothDevice.BOND_BONDED)) {
+ BluetoothDevice device = intent
+ .getParcelableExtra(BluetoothDevice.EXTRA_DEVICE);
+
+ caLeBondStateChangedCallback(device.getAddress());
+ }
+ }
+ }
+ }
+ };
+}
+
--- /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.
+ *
+ ******************************************************************/
+
+package org.iotivity.ca;
+
+import android.bluetooth.BluetoothDevice;
+import android.bluetooth.BluetoothGattCharacteristic;
+import android.bluetooth.BluetoothGattDescriptor;
+import android.bluetooth.BluetoothGattServerCallback;
+import android.bluetooth.BluetoothGattService;
+import android.bluetooth.le.AdvertiseCallback;
+import android.bluetooth.le.AdvertiseSettings;
+
+public class CaLeServerInterface {
+
+ private CaLeServerInterface() {
+
+ caLeRegisterGattServerCallback(mGattServerCallback);
+ caLeRegisterBluetoothLeAdvertiseCallback(mAdvertiseCallback);
+ }
+
+ public static void getLeGattServerCallback() {
+ caLeRegisterGattServerCallback(mGattServerCallback);
+ }
+
+ public static void getBluetoothLeAdvertiseCallback() {
+ caLeRegisterBluetoothLeAdvertiseCallback(mAdvertiseCallback);
+ }
+
+ private native static void caLeRegisterGattServerCallback(BluetoothGattServerCallback callback);
+
+ private native static void caLeRegisterBluetoothLeAdvertiseCallback(AdvertiseCallback callback);
+
+ // BluetoothGattServerCallback
+ private native static void caLeGattServerConnectionStateChangeCallback(
+ BluetoothDevice device, int status, int newState);
+
+ private native static void caLeGattServerServiceAddedCallback(int status,
+ BluetoothGattService service);
+
+ private native static void caLeGattServerCharacteristicReadRequestCallback(
+ BluetoothDevice device,
+ int requestId, int offset, BluetoothGattCharacteristic characteristic, byte[] data);
+
+ private native static void caLeGattServerCharacteristicWriteRequestCallback(
+ BluetoothDevice device, int requestId,
+ BluetoothGattCharacteristic characteristic, byte[] data, boolean preparedWrite,
+ boolean responseNeeded, int offset, byte[] value);
+
+ private native static void caLeGattServerDescriptorReadRequestCallback(
+ BluetoothDevice device, int requestId, int offset, BluetoothGattDescriptor descriptor);
+
+ public native static void caLeGattServerDescriptorWriteRequestCallback(
+ BluetoothDevice device, int requestId, BluetoothGattDescriptor descriptor,
+ boolean preparedWrite, boolean responseNeeded, int offset, byte[] value);
+
+ private native static void caLeGattServerExecuteWriteCallback(BluetoothDevice device,
+ int requestId, boolean execute);
+
+ private native static void caLeGattServerNotificationSentCallback(BluetoothDevice device,
+ int status);
+
+ // AdvertiseCallback
+ private native static void caLeAdvertiseStartSuccessCallback(
+ AdvertiseSettings settingsInEffect);
+
+ private native static void caLeAdvertiseStartFailureCallback(int errorCode);
+
+ private static final BluetoothGattServerCallback mGattServerCallback =
+ new BluetoothGattServerCallback() {
+
+ @Override
+ public void onConnectionStateChange(BluetoothDevice device, int status,
+ int newState) {
+ super.onConnectionStateChange(device, status, newState);
+
+ caLeGattServerConnectionStateChangeCallback(device, status, newState);
+ }
+
+ @Override
+ public void onServiceAdded(int status, BluetoothGattService service) {
+ super.onServiceAdded(status, service);
+
+ caLeGattServerServiceAddedCallback(status, service);
+ }
+
+ @Override
+ public void onCharacteristicReadRequest(
+ BluetoothDevice device, int requestId, int offset,
+ BluetoothGattCharacteristic characteristic) {
+ super.onCharacteristicReadRequest(device, requestId, offset, characteristic);
+
+ caLeGattServerCharacteristicReadRequestCallback(device, requestId, offset,
+ characteristic,
+ characteristic.getValue());
+ }
+
+ @Override
+ public void onCharacteristicWriteRequest(
+ BluetoothDevice device, int requestId, BluetoothGattCharacteristic characteristic,
+ boolean preparedWrite, boolean responseNeeded, int offset, byte[] value) {
+ super.onCharacteristicWriteRequest(device, requestId, characteristic,
+ preparedWrite, responseNeeded, offset, value);
+
+ caLeGattServerCharacteristicWriteRequestCallback(device, requestId, characteristic,
+ value, preparedWrite, responseNeeded,
+ offset, value);
+ }
+
+ @Override
+ public void onDescriptorReadRequest(
+ BluetoothDevice device,
+ int requestId, int offset, BluetoothGattDescriptor descriptor) {
+ super.onDescriptorReadRequest(device, requestId, offset, descriptor);
+
+ caLeGattServerDescriptorReadRequestCallback(device, requestId, offset, descriptor);
+ }
+
+ @Override
+ public void onDescriptorWriteRequest(
+ BluetoothDevice device, int requestId, BluetoothGattDescriptor descriptor,
+ boolean preparedWrite, boolean responseNeeded, int offset,
+ byte[] value) {
+ super.onDescriptorWriteRequest(device, requestId, descriptor, preparedWrite,
+ responseNeeded, offset, value);
+
+ caLeGattServerDescriptorWriteRequestCallback(device, requestId, descriptor,
+ preparedWrite, responseNeeded, offset,
+ value);
+ }
+
+ @Override
+ public void onExecuteWrite(BluetoothDevice device, int requestId, boolean execute) {
+ super.onExecuteWrite(device, requestId, execute);
+
+ caLeGattServerExecuteWriteCallback(device, requestId, execute);
+ }
+
+ @Override
+ public void onNotificationSent(BluetoothDevice device, int status) {
+ super.onNotificationSent(device, status);
+
+ caLeGattServerNotificationSentCallback(device, status);
+ }
+ };
+
+ private static final AdvertiseCallback mAdvertiseCallback = new AdvertiseCallback() {
+
+ @Override
+ public void onStartSuccess(AdvertiseSettings settingsInEffect) {
+ super.onStartSuccess(settingsInEffect);
+
+ caLeAdvertiseStartSuccessCallback(settingsInEffect);
+ }
+
+ @Override
+ public void onStartFailure(int errorCode) {
+ super.onStartFailure(errorCode);
+
+ caLeAdvertiseStartFailureCallback(errorCode);
+ }
+ };
+}
-package org.iotivity.service;
+package org.iotivity.ca.service;
import android.os.Handler;
import android.widget.TextView;
-package org.iotivity.service;
+package org.iotivity.ca.service;
import android.app.Activity;
import android.app.AlertDialog;
import android.widget.RelativeLayout;
import android.widget.TextView;
-import org.iotivity.sample_service.R;
+import org.iotivity.ca.sample_service.R;
public class MainActivity extends Activity {
-package org.iotivity.service;
+package org.iotivity.ca.service;
import android.content.Context;
System.loadLibrary("RMInterface");
}
- private org.iotivity.service.MainActivity mResponseListener = null;
+ private org.iotivity.ca.service.MainActivity mResponseListener = null;
public native void setNativeResponseListener(Object listener);
public native void RMHandleRequestResponse();
- public void setResponseListener(org.iotivity.service.MainActivity listener) {
+ public void setResponseListener(org.iotivity.ca.service.MainActivity listener) {
mResponseListener = listener;
setNativeResponseListener(this);
}
+++ /dev/null
-package org.iotivity.jar;
-
-import android.bluetooth.BluetoothAdapter;
-import android.bluetooth.BluetoothDevice;
-import android.bluetooth.BluetoothGatt;
-import android.bluetooth.BluetoothGattCallback;
-import android.bluetooth.BluetoothGattCharacteristic;
-import android.bluetooth.BluetoothGattDescriptor;
-import android.bluetooth.BluetoothGattServerCallback;
-import android.bluetooth.BluetoothGattService;
-import android.bluetooth.le.AdvertiseCallback;
-import android.bluetooth.le.AdvertiseSettings;
-import android.content.BroadcastReceiver;
-import android.content.Context;
-import android.content.Intent;
-import android.content.IntentFilter;
-import android.util.Log;
-
-public class CALeInterface {
-
- public CALeInterface(Context context) {
-
- CARegisterLeScanCallback(mLeScanCallback);
- CARegisterLeGattCallback(mGattCallback);
- CARegisterLeGattServerCallback(mGattServerCallback);
- CARegisterBluetoothLeAdvertiseCallback(mAdvertiseCallback);
-
- registerIntentFilter(context);
- }
-
- public static void getLeScanCallback() {
- CARegisterLeScanCallback(mLeScanCallback);
- }
-
- public static void getLeGattCallback() {
- CARegisterLeGattCallback(mGattCallback);
- }
-
- public static void getLeGattServerCallback() {
- CARegisterLeGattServerCallback(mGattServerCallback);
- }
-
- public static void getBluetoothLeAdvertiseCallback() {
- CARegisterBluetoothLeAdvertiseCallback(mAdvertiseCallback);
- }
-
- public static IntentFilter registerIntentFilter(Context context) {
- IntentFilter filter = new IntentFilter();
- filter.addAction(BluetoothAdapter.ACTION_STATE_CHANGED);
- context.registerReceiver(mReceiver, filter);
- return filter;
- }
-
- public native static void CARegisterLeScanCallback(
- BluetoothAdapter.LeScanCallback callback);
-
- public native static void CARegisterLeGattCallback(
- BluetoothGattCallback callback);
-
- public native static void CARegisterLeGattServerCallback(
- BluetoothGattServerCallback callback);
-
- public native static void CARegisterBluetoothLeAdvertiseCallback(
- AdvertiseCallback callback);
-
- // BluetoothAdapter.LeScanCallback
- public native static void CALeScanCallback(BluetoothDevice device,
- int rssi, byte[] scanRecord);
-
- // BluetoothGattCallback
- public native static void CALeGattConnectionStateChangeCallback(
- BluetoothGatt gatt, int status, int newState);
-
- public native static void CALeGattServicesDiscoveredCallback(
- BluetoothGatt gatt, int status);
-
- public native static void CALeGattCharacteristicReadCallback(
- BluetoothGatt gatt, BluetoothGattCharacteristic characteristic,
- byte[] data, int status);
-
- public native static void CALeGattCharacteristicWriteCallback(
- BluetoothGatt gatt, BluetoothGattCharacteristic characteristic,
- byte[] data, int status);
-
- public native static void CALeGattCharacteristicChangedCallback(
- BluetoothGatt gatt, BluetoothGattCharacteristic characteristic,
- byte[] data);
-
- public native static void CALeGattDescriptorReadCallback(
- BluetoothGatt gatt, BluetoothGattDescriptor descriptor, int status);
-
- public native static void CALeGattDescriptorWriteCallback(
- BluetoothGatt gatt, BluetoothGattDescriptor descriptor, int status);
-
- public native static void CALeGattReliableWriteCompletedCallback(
- BluetoothGatt gatt, int status);
-
- public native static void CALeGattReadRemoteRssiCallback(
- BluetoothGatt gatt, int rssi, int status);
-
- // BluetoothGattServerCallback
- public native static void CALeGattServerConnectionStateChangeCallback(
- BluetoothDevice device, int status, int newState);
-
- public native static void CALeGattServerServiceAddedCallback(int status,
- BluetoothGattService service);
-
- public native static void CALeGattServerCharacteristicReadRequestCallback(
- BluetoothDevice device, int requestId, int offset,
- BluetoothGattCharacteristic characteristic, byte[] data);
-
- public native static void CALeGattServerCharacteristicWriteRequestCallback(
- BluetoothDevice device, int requestId,
- BluetoothGattCharacteristic characteristic, byte[] data,
- boolean preparedWrite, boolean responseNeeded, int offset,
- byte[] value);
-
- public native static void CALeGattServerDescriptorReadRequestCallback(
- BluetoothDevice device, int requestId, int offset,
- BluetoothGattDescriptor descriptor);
-
- public native static void CALeGattServerDescriptorWriteRequestCallback(
- BluetoothDevice device, int requestId,
- BluetoothGattDescriptor descriptor, boolean preparedWrite,
- boolean responseNeeded, int offset, byte[] value);
-
- public native static void CALeGattServerExecuteWriteCallback(
- BluetoothDevice device, int requestId, boolean execute);
-
- public native static void CALeGattServerNotificationSentCallback(
- BluetoothDevice device, int status);
-
- // AdvertiseCallback
- public native static void CALeAdvertiseStartSuccessCallback(
- AdvertiseSettings settingsInEffect);
-
- public native static void CALeAdvertiseStartFailureCallback(int errorCode);
-
- // Network Monitor
- public native static void CALeStateChangedCallback(int state);
-
- // Callback
- private static BluetoothAdapter.LeScanCallback mLeScanCallback
- = new BluetoothAdapter.LeScanCallback() {
-
- @Override
- public void onLeScan(BluetoothDevice device, int rssi, byte[] scanRecord) {
-
- try {
- CALeScanCallback(device, rssi, scanRecord);
- } catch(UnsatisfiedLinkError e) {
-
- }
- }
- };
-
- private static final BluetoothGattCallback mGattCallback = new BluetoothGattCallback() {
-
- @Override
- public void onConnectionStateChange(BluetoothGatt gatt, int status, int newState) {
- super.onConnectionStateChange(gatt, status, newState);
-
- CALeGattConnectionStateChangeCallback(gatt, status, newState);
- }
-
- @Override
- public void onServicesDiscovered(BluetoothGatt gatt, int status) {
- super.onServicesDiscovered(gatt, status);
-
- CALeGattServicesDiscoveredCallback(gatt, status);
- }
-
- @Override
- public void onCharacteristicRead(BluetoothGatt gatt,
- BluetoothGattCharacteristic characteristic, int status) {
- super.onCharacteristicRead(gatt, characteristic, status);
-
- CALeGattCharacteristicReadCallback(gatt, characteristic,
- characteristic.getValue(), status);
- }
-
- @Override
- public void onCharacteristicWrite(BluetoothGatt gatt,
- BluetoothGattCharacteristic characteristic, int status) {
- super.onCharacteristicWrite(gatt, characteristic, status);
-
- CALeGattCharacteristicWriteCallback(gatt, characteristic,
- characteristic.getValue(), status);
- }
-
- @Override
- public void onCharacteristicChanged(BluetoothGatt gatt,
- BluetoothGattCharacteristic characteristic) {
- super.onCharacteristicChanged(gatt, characteristic);
-
- CALeGattCharacteristicChangedCallback(gatt, characteristic,
- characteristic.getValue());
- }
-
- @Override
- public void onDescriptorRead(BluetoothGatt gatt, BluetoothGattDescriptor descriptor,
- int status) {
- super.onDescriptorRead(gatt, descriptor, status);
-
- CALeGattDescriptorReadCallback(gatt, descriptor, status);
- }
-
- @Override
- public void onDescriptorWrite(BluetoothGatt gatt, BluetoothGattDescriptor descriptor,
- int status) {
- super.onDescriptorWrite(gatt, descriptor, status);
-
- CALeGattDescriptorWriteCallback(gatt, descriptor, status);
- }
-
- @Override
- public void onReliableWriteCompleted(BluetoothGatt gatt, int status) {
- super.onReliableWriteCompleted(gatt, status);
-
- CALeGattReliableWriteCompletedCallback(gatt, status);
- }
-
- @Override
- public void onReadRemoteRssi(BluetoothGatt gatt, int rssi, int status) {
- super.onReadRemoteRssi(gatt, rssi, status);
-
- CALeGattReadRemoteRssiCallback(gatt, rssi, status);
- }
- };
-
- private static final BluetoothGattServerCallback mGattServerCallback
- = new BluetoothGattServerCallback() {
-
- @Override
- public void onConnectionStateChange(BluetoothDevice device, int status,
- int newState) {
- super.onConnectionStateChange(device, status, newState);
-
- CALeGattServerConnectionStateChangeCallback(device, status, newState);
- }
-
- @Override
- public void onServiceAdded(int status, BluetoothGattService service) {
- super.onServiceAdded(status, service);
-
- CALeGattServerServiceAddedCallback(status, service);
- }
-
- @Override
- public void onCharacteristicReadRequest(BluetoothDevice device,
- int requestId, int offset,
- BluetoothGattCharacteristic characteristic) {
- super.onCharacteristicReadRequest(device, requestId, offset, characteristic);
-
- CALeGattServerCharacteristicReadRequestCallback(device, requestId, offset,
- characteristic, characteristic.getValue());
- }
-
- @Override
- public void onCharacteristicWriteRequest(BluetoothDevice device,
- int requestId, BluetoothGattCharacteristic characteristic,
- boolean preparedWrite, boolean responseNeeded, int offset,
- byte[] value) {
- super.onCharacteristicWriteRequest(device, requestId, characteristic,
- preparedWrite, responseNeeded, offset, value);
-
- CALeGattServerCharacteristicWriteRequestCallback(device, requestId, characteristic,
- value, preparedWrite, responseNeeded, offset, value);
- }
-
- @Override
- public void onDescriptorReadRequest(BluetoothDevice device,
- int requestId, int offset, BluetoothGattDescriptor descriptor) {
- super.onDescriptorReadRequest(device, requestId, offset, descriptor);
-
- CALeGattServerDescriptorReadRequestCallback(device, requestId, offset, descriptor);
- }
-
- @Override
- public void onDescriptorWriteRequest(BluetoothDevice device,
- int requestId, BluetoothGattDescriptor descriptor,
- boolean preparedWrite, boolean responseNeeded, int offset,
- byte[] value) {
- super.onDescriptorWriteRequest(device, requestId, descriptor, preparedWrite,
- responseNeeded, offset, value);
-
- CALeGattServerDescriptorWriteRequestCallback(device, requestId, descriptor,
- preparedWrite, responseNeeded, offset, value);
- }
-
- @Override
- public void onExecuteWrite(BluetoothDevice device, int requestId,
- boolean execute) {
- super.onExecuteWrite(device, requestId, execute);
-
- CALeGattServerExecuteWriteCallback(device, requestId, execute);
- }
-
- @Override
- public void onNotificationSent(BluetoothDevice device, int status) {
- super.onNotificationSent(device, status);
-
- CALeGattServerNotificationSentCallback(device, status);
- }
- };
-
- private static final AdvertiseCallback mAdvertiseCallback = new AdvertiseCallback() {
-
- @Override
- public void onStartSuccess(AdvertiseSettings settingsInEffect) {
- super.onStartSuccess(settingsInEffect);
-
- CALeAdvertiseStartSuccessCallback(settingsInEffect);
- }
-
- @Override
- public void onStartFailure(int errorCode) {
- super.onStartFailure(errorCode);
-
- CALeAdvertiseStartFailureCallback(errorCode);
- }
- };
-
- private static final BroadcastReceiver mReceiver = new BroadcastReceiver() {
-
- @Override
- public void onReceive(Context context, Intent intent) {
-
- String action = intent.getAction();
-
- if (action != null && action.equals(BluetoothAdapter.ACTION_STATE_CHANGED)) {
-
- int state = intent.getIntExtra(BluetoothAdapter.EXTRA_STATE,
- BluetoothAdapter.ERROR);
- // STATE_ON:12, STATE_OFF:10
- if (state == BluetoothAdapter.STATE_ON || state == BluetoothAdapter.STATE_OFF) {
- CALeStateChangedCallback(state);
- }
- }
- }
- };
-}
-
+++ /dev/null
-package org.iotivity.jar;
-
-import android.content.BroadcastReceiver;
-import android.content.Context;
-import android.content.Intent;
-import android.content.IntentFilter;
-import android.net.ConnectivityManager;
-import android.net.NetworkInfo;
-import android.net.wifi.WifiManager;
-import android.util.Log;
-
-public class caipinterface {
-
- private static String TAG = "caipinterface";
- private static Context mContext = null;
-
- public caipinterface(Context context) {
- Log.d(TAG, "caipinterface");
- mContext = context;
- registerIpStateReceiver();
- }
-
- private void registerIpStateReceiver() {
-
- IntentFilter intentFilter = new IntentFilter();
- intentFilter.addAction(WifiManager.WIFI_STATE_CHANGED_ACTION);
- intentFilter.addAction(ConnectivityManager.CONNECTIVITY_ACTION);
-
- mContext.registerReceiver(mReceiver, intentFilter);
- }
-
- private static BroadcastReceiver mReceiver = new BroadcastReceiver() {
-
- @Override
- public void onReceive(Context context, Intent intent) {
- if (intent.getIntExtra(WifiManager.EXTRA_WIFI_STATE,
- WifiManager.WIFI_STATE_UNKNOWN) == WifiManager.WIFI_STATE_DISABLED) {
- CAIPStateDisabled();
- } else if (intent.getAction().equals(ConnectivityManager.CONNECTIVITY_ACTION)) {
- ConnectivityManager manager = (ConnectivityManager)
- mContext.getSystemService(Context.CONNECTIVITY_SERVICE);
- NetworkInfo nwInfo = manager.getNetworkInfo(ConnectivityManager.TYPE_WIFI);
-
- if(nwInfo.isConnected()) {
- CAIPStateEnabled();
- }
- }
- }
- };
-
- public native static void CAIPStateEnabled();
-
- public native static void CAIPStateDisabled();
-}
-
"(Ljava/lang/String;)Landroid/bluetooth/BluetoothDevice;";
static const char CLASSPATH_BT_ADPATER[] = "android/bluetooth/BluetoothAdapter";
static const char CLASSPATH_BT_DEVICE[] = "android/bluetooth/BluetoothDevice";
-static const char CLASSPATH_BT_INTERFACE[] = "org/iotivity/jar/caedrinterface";
+static const char CLASSPATH_BT_INTERFACE[] = "org/iotivity/ca/CaEdrInterface";
static const char CLASSPATH_BT_SOCKET[] = "android/bluetooth/BluetoothSocket";
static const char CLASSPATH_BT_UUID[] = "java/util/UUID";
static const char CLASSPATH_CONTEXT[] = "android/content/Context";
jclass EDRJniInterface = (*env)->FindClass(env, CLASSPATH_BT_INTERFACE);
if (!EDRJniInterface)
{
- OIC_LOG(ERROR, TAG, "[EDRCore] Could not get caedrinterface class");
+ OIC_LOG(ERROR, TAG, "[EDRCore] Could not get CaEdrInterface class");
return CA_STATUS_FAILED;
}
"(Landroid/content/Context;)V");
if (!EDRInterfaceConstructorMethod)
{
- OIC_LOG(ERROR, TAG, "[EDRCore] Could not get caedrinterface constructor method");
+ OIC_LOG(ERROR, TAG, "[EDRCore] Could not get CaEdrInterface constructor method");
return CA_STATUS_FAILED;
}
if (g_context)
{
- CAEDRCreateJNIInterfaceObject(g_context); /* create java caedrinterface instance*/
+ CAEDRCreateJNIInterfaceObject(g_context); /* create java CaEdrInterface instance*/
}
OIC_LOG(DEBUG, TAG, "OUT");
#include "caedrserver.h"
#include "caedrutils.h"
-#include "org_iotivity_jar_caedrinterface.h"
+#include "org_iotivity_ca_CaEdrInterface.h"
//#define DEBUG_MODE
#define TAG PCF("CA_EDR_MONITOR")
}
JNIEXPORT void JNICALL
-Java_org_iotivity_jar_caedrinterface_CAEDRStateChangedCallback(JNIEnv *env, jobject obj,
+Java_org_iotivity_ca_CaEdrInterface_caEdrStateChangedCallback(JNIEnv *env, jobject obj,
jint status)
{
// STATE_ON:12, STATE_OFF:10
- OIC_LOG(DEBUG, TAG, "caedrinterface - Network State Changed");
+ OIC_LOG(DEBUG, TAG, "CaEdrInterface - Network State Changed");
if (NULL == g_networkChangeCb)
{
}
JNIEXPORT void JNICALL
-Java_org_iotivity_jar_caedrinterface_CAEDRBondStateChangedCallback(JNIEnv *env, jobject obj,
+Java_org_iotivity_ca_CaEdrInterface_caEdrBondStateChangedCallback(JNIEnv *env, jobject obj,
jstring addr)
{
- OIC_LOG(DEBUG, TAG, "caedrinterface - Bond State Changed");
+ OIC_LOG(DEBUG, TAG, "CaEdrInterface - Bond State Changed");
if (addr)
{
#include "camutex.h"
#include "uarraylist.h"
#include "caadapterutils.h"
-#include "org_iotivity_jar_caedrinterface.h"
+#include "org_iotivity_ca_CaEdrInterface.h"
//#define DEBUG_MODE
#define TAG PCF("CA_EDR_SERVER")
--- /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.
+ *
+ ******************************************************************/
+
+#include <jni.h>
+/* Header for class org_iotivity_ca_CaEdrInterface */
+
+#ifndef Included_org_iotivity_ca_CaEdrInterface
+#define Included_org_iotivity_ca_CaEdrInterface
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+/*
+ * Class: org_iotivity_ca_CaEdrInterface
+ * Method: caEdrStateChangedCallback
+ * Signature: (I)V
+ */
+JNIEXPORT void JNICALL
+Java_org_iotivity_ca_CaEdrInterface_caEdrStateChangedCallback
+(JNIEnv *, jobject, jint);
+
+/*
+ * Class: org_iotivity_ca_CaEdrInterface
+ * Method: caEdrBondStateChangedCallback
+ * Signature: (I)V
+ */
+JNIEXPORT void JNICALL
+Java_org_iotivity_ca_CaEdrInterface_caEdrBondStateChangedCallback
+(JNIEnv *, jobject, jstring);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
+++ /dev/null
-#include <jni.h>
-/* Header for class org_iotivity_jar_caedrinterface */
-
-#ifndef Included_org_iotivity_jar_caedrinterface
-#define Included_org_iotivity_jar_caedrinterface
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-/*
- * Class: org_iotivity_jar_caedrinterface
- * Method: CAEDRStateChangedCallback
- * Signature: (I)V
- */
-JNIEXPORT void JNICALL
-Java_org_iotivity_jar_caedrinterface_CAEDRStateChangedCallback
-(JNIEnv *, jobject, jint);
-
-/*
- * Class: org_iotivity_jar_caedrinterface
- * Method: CAEDRStateChangedCallback
- * Signature: (I)V
- */
-JNIEXPORT void JNICALL
-Java_org_iotivity_jar_caedrinterface_CAEDRBondStateChangedCallback
-(JNIEnv *, jobject, jstring);
-
-#ifdef __cplusplus
-}
-#endif
-#endif
#include "cathreadpool.h" /* for thread pool */
#include "camutex.h"
#include "uarraylist.h"
-#include "org_iotivity_jar_caleclientinterface.h"
+#include "org_iotivity_ca_CaLeClientInterface.h"
#define TAG PCF("CA_LE_CLIENT")
isAttached = true;
}
- jclass jni_LEInterface = (*env)->FindClass(env, "org/iotivity/jar/caleclientinterface");
+ jclass jni_LEInterface = (*env)->FindClass(env, "org/iotivity/ca/CaLeClientInterface");
if (!jni_LEInterface)
{
- OIC_LOG(ERROR, TAG, "Could not get caleclientinterface class");
+ OIC_LOG(ERROR, TAG, "Could not get CaLeClientInterface class");
goto error_exit;
}
"(Landroid/content/Context;)V");
if (!LeInterfaceConstructorMethod)
{
- OIC_LOG(ERROR, TAG, "Could not get caleclientinterface constructor method");
+ OIC_LOG(ERROR, TAG, "Could not get CaLeClientInterface constructor method");
goto error_exit;
}
(*env)->NewObject(env, jni_LEInterface, LeInterfaceConstructorMethod, g_context);
- OIC_LOG(DEBUG, TAG, "Create instance for caleclientinterface");
+ OIC_LOG(DEBUG, TAG, "Create instance for CaLeClientInterface");
if (isAttached)
{
}
JNIEXPORT void JNICALL
-Java_org_iotivity_jar_caleclientinterface_CARegisterLeScanCallback(JNIEnv *env, jobject obj,
- jobject callback)
+Java_org_iotivity_ca_CaLeClientInterface_caLeRegisterLeScanCallback(JNIEnv *env, jobject obj,
+ jobject callback)
{
- OIC_LOG(DEBUG, TAG, "CARegisterLeScanCallback");
+ OIC_LOG(DEBUG, TAG, "CaLeRegisterLeScanCallback");
VERIFY_NON_NULL_VOID(env, TAG, "env is null");
VERIFY_NON_NULL_VOID(callback, TAG, "callback is null");
}
JNIEXPORT void JNICALL
-Java_org_iotivity_jar_caleclientinterface_CARegisterLeGattCallback(JNIEnv *env, jobject obj,
- jobject callback)
+Java_org_iotivity_ca_CaLeClientInterface_caLeRegisterGattCallback(JNIEnv *env, jobject obj,
+ jobject callback)
{
- OIC_LOG(DEBUG, TAG, "CARegisterLeGattCallback");
+ OIC_LOG(DEBUG, TAG, "CaLeRegisterGattCallback");
VERIFY_NON_NULL_VOID(env, TAG, "env is null");
VERIFY_NON_NULL_VOID(callback, TAG, "callback is null");
}
JNIEXPORT void JNICALL
-Java_org_iotivity_jar_caleclientinterface_CALeScanCallback(JNIEnv *env, jobject obj,
+Java_org_iotivity_ca_CaLeClientInterface_caLeScanCallback(JNIEnv *env, jobject obj,
jobject device, jint rssi,
jbyteArray scanRecord)
{
}
/*
- * Class: org_iotivity_jar_caleinterface
+ * Class: org_iotivity_ca_jar_caleinterface
* Method: CALeGattConnectionStateChangeCallback
* Signature: (Landroid/bluetooth/BluetoothGatt;II)V
*/
JNIEXPORT void JNICALL
-Java_org_iotivity_jar_caleclientinterface_CALeGattConnectionStateChangeCallback(JNIEnv *env,
+Java_org_iotivity_ca_CaLeClientInterface_caLeGattConnectionStateChangeCallback(JNIEnv *env,
jobject obj,
jobject gatt,
jint status,
}
/*
- * Class: org_iotivity_jar_caleinterface
+ * Class: org_iotivity_ca_jar_caleinterface
* Method: CALeGattServicesDiscoveredCallback
* Signature: (Landroid/bluetooth/BluetoothGatt;I)V
*/
JNIEXPORT void JNICALL
-Java_org_iotivity_jar_caleclientinterface_CALeGattServicesDiscoveredCallback(JNIEnv *env,
+Java_org_iotivity_ca_CaLeClientInterface_caLeGattServicesDiscoveredCallback(JNIEnv *env,
jobject obj,
jobject gatt,
jint status)
}
/*
- * Class: org_iotivity_jar_caleinterface
+ * Class: org_iotivity_ca_jar_caleinterface
* Method: CALeGattCharacteristicReadCallback
* Signature: (Landroid/bluetooth/BluetoothGatt;Landroid/bluetooth/BluetoothGattCharacteristic;I)V
*/
JNIEXPORT void JNICALL
-Java_org_iotivity_jar_caleclientinterface_CALeGattCharacteristicReadCallback(JNIEnv *env,
+Java_org_iotivity_ca_CaLeClientInterface_caLeGattCharacteristicReadCallback(JNIEnv *env,
jobject obj,
jobject gatt,
jobject characteristic,
}
/*
- * Class: org_iotivity_jar_caleinterface
+ * Class: org_iotivity_ca_jar_caleinterface
* Method: CALeGattCharacteristicWritjclasseCallback
* Signature: (Landroid/bluetooth/BluetoothGatt;Landroid/bluetooth/BluetoothGattCharacteristic;I)V
*/
JNIEXPORT void JNICALL
-Java_org_iotivity_jar_caleclientinterface_CALeGattCharacteristicWriteCallback(
+Java_org_iotivity_ca_CaLeClientInterface_caLeGattCharacteristicWriteCallback(
JNIEnv *env, jobject obj, jobject gatt, jobject characteristic, jbyteArray data,
jint status)
{
}
/*
- * Class: org_iotivity_jar_caleinterface
+ * Class: org_iotivity_ca_jar_caleinterface
* Method: CALeGattCharacteristicChangedCallback
* Signature: (Landroid/bluetooth/BluetoothGatt;Landroid/bluetooth/BluetoothGattCharacteristic;)V
*/
JNIEXPORT void JNICALL
-Java_org_iotivity_jar_caleclientinterface_CALeGattCharacteristicChangedCallback(
+Java_org_iotivity_ca_CaLeClientInterface_caLeGattCharacteristicChangedCallback(
JNIEnv *env, jobject obj, jobject gatt, jobject characteristic, jbyteArray data)
{
OIC_LOG(DEBUG, TAG, "CALeGattCharacteristicChangedCallback");
}
/*
- * Class: org_iotivity_jar_caleinterface
+ * Class: org_iotivity_ca_jar_caleinterface
* Method: CALeGattDescriptorReadCallback
* Signature: (Landroid/bluetooth/BluetoothGatt;Landroid/bluetooth/BluetoothGattDescriptor;I)V
*/
JNIEXPORT void JNICALL
-Java_org_iotivity_jar_caleclientinterface_CALeGattDescriptorReadCallback(JNIEnv *env, jobject obj,
+Java_org_iotivity_ca_CaLeClientInterface_caLeGattDescriptorReadCallback(JNIEnv *env, jobject obj,
jobject gatt,
jobject descriptor,
jint status)
}
/*
- * Class: org_iotivity_jar_caleinterface
+ * Class: org_iotivity_ca_jar_caleinterface
* Method: CALeGattDescriptorWriteCallback
* Signature: (Landroid/bluetooth/BluetoothGatt;Landroid/bluetooth/BluetoothGattDescriptor;I)V
*/
JNIEXPORT void JNICALL
-Java_org_iotivity_jar_caleclientinterface_CALeGattDescriptorWriteCallback(JNIEnv *env, jobject obj,
+Java_org_iotivity_ca_CaLeClientInterface_caLeGattDescriptorWriteCallback(JNIEnv *env, jobject obj,
jobject gatt,
jobject descriptor,
jint status)
}
/*
- * Class: org_iotivity_jar_caleinterface
+ * Class: org_iotivity_ca_jar_caleinterface
* Method: CALeGattReliableWriteCompletedCallback
* Signature: (Landroid/bluetooth/BluetoothGatt;I)V
*/
JNIEXPORT void JNICALL
-Java_org_iotivity_jar_caleclientinterface_CALeGattReliableWriteCompletedCallback(JNIEnv *env,
+Java_org_iotivity_ca_CaLeClientInterface_caLeGattReliableWriteCompletedCallback(JNIEnv *env,
jobject obj,
jobject gatt,
jint status)
}
/*
- * Class: org_iotivity_jar_caleinterface
+ * Class: org_iotivity_ca_jar_caleinterface
* Method: CALeGattReadRemoteRssiCallback
* Signature: (Landroid/bluetooth/BluetoothGatt;II)V
*/
JNIEXPORT void JNICALL
-Java_org_iotivity_jar_caleclientinterface_CALeGattReadRemoteRssiCallback(JNIEnv *env, jobject obj,
+Java_org_iotivity_ca_CaLeClientInterface_caLeGattReadRemoteRssiCallback(JNIEnv *env, jobject obj,
jobject gatt, jint rssi,
jint status)
{
#include "camutex.h"
-#include "org_iotivity_jar_caleclientinterface.h"
+#include "org_iotivity_ca_CaLeClientInterface.h"
#define TAG PCF("CA_LE_MONITOR")
}
JNIEXPORT void JNICALL
-Java_org_iotivity_jar_caleclientinterface_CALeStateChangedCallback(JNIEnv *env, jobject obj,
+Java_org_iotivity_ca_CaLeClientInterface_caLeStateChangedCallback(JNIEnv *env, jobject obj,
jint status)
{
VERIFY_NON_NULL_VOID(env, TAG, "env is null");
- OIC_LOG(DEBUG, TAG, "caleclientinterface - Network State Changed");
+ OIC_LOG(DEBUG, TAG, "CaLeClientInterface - Network State Changed");
if (!gCALEDeviceStateChangedCallback)
{
}
JNIEXPORT void JNICALL
-Java_org_iotivity_jar_caleclientinterface_CALeBondStateChangedCallback(JNIEnv *env, jobject obj,
+Java_org_iotivity_ca_CaLeClientInterface_caLeBondStateChangedCallback(JNIEnv *env, jobject obj,
jstring addr)
{
- OIC_LOG(DEBUG, TAG, "caleclientinterface - Bond State Changed");
+ OIC_LOG(DEBUG, TAG, "CaLeClientInterface - Bond State Changed");
VERIFY_NON_NULL_VOID(env, TAG, "env is null");
VERIFY_NON_NULL_VOID(addr, TAG, "addr is null");
#include "cathreadpool.h"
#include "camutex.h"
#include "uarraylist.h"
-#include "org_iotivity_jar_caleserverinterface.h"
+#include "org_iotivity_ca_CaLeServerInterface.h"
#define TAG PCF("CA_LE_SERVER")
isAttached = true;
}
- jclass jni_LEInterface = (*env)->FindClass(env, "org/iotivity/jar/caleserverinterface");
+ jclass jni_LEInterface = (*env)->FindClass(env, "org/iotivity/ca/CaLeServerInterface");
if (!jni_LEInterface)
{
- OIC_LOG(ERROR, TAG, "Could not get caleserverinterface class");
+ OIC_LOG(ERROR, TAG, "Could not get CaLeServerInterface class");
goto exit;
}
"()V");
if (!LeInterfaceConstructorMethod)
{
- OIC_LOG(ERROR, TAG, "Could not get caleserverinterface constructor method");
+ OIC_LOG(ERROR, TAG, "Could not get CaLeServerInterface constructor method");
goto exit;
}
(*env)->NewObject(env, jni_LEInterface, LeInterfaceConstructorMethod, g_context);
- OIC_LOG(DEBUG, TAG, "Create instance for caleserverinterface");
+ OIC_LOG(DEBUG, TAG, "Create instance for CaLeServerInterface");
if (isAttached)
{
}
JNIEXPORT void JNICALL
-Java_org_iotivity_jar_caleserverinterface_CARegisterLeGattServerCallback(JNIEnv *env, jobject obj,
+Java_org_iotivity_ca_CaLeServerInterface_caLeRegisterGattServerCallback(JNIEnv *env, jobject obj,
jobject callback)
{
- OIC_LOG(DEBUG, TAG, "caleserverinterface - Register Le Gatt Server Callback");
+ OIC_LOG(DEBUG, TAG, "CaLeServerInterface - Register Le Gatt Server Callback");
VERIFY_NON_NULL_VOID(env, TAG, "env is null");
VERIFY_NON_NULL_VOID(callback, TAG, "callback is null");
}
JNIEXPORT void JNICALL
-Java_org_iotivity_jar_caleserverinterface_CARegisterBluetoothLeAdvertiseCallback(JNIEnv *env,
- jobject obj,
- jobject callback)
+Java_org_iotivity_ca_CaLeServerInterface_caLeRegisterBluetoothLeAdvertiseCallback(JNIEnv *env,
+ jobject obj,
+ jobject callback)
{
- OIC_LOG(DEBUG, TAG, "caleserverinterface - Register Le Advertise Callback");
+ OIC_LOG(DEBUG, TAG, "CaLeServerInterface - Register Le Advertise Callback");
VERIFY_NON_NULL_VOID(env, TAG, "env is null");
VERIFY_NON_NULL_VOID(callback, TAG, "callback is null");
}
JNIEXPORT void JNICALL
-Java_org_iotivity_jar_caleserverinterface_CALeGattServerConnectionStateChangeCallback(
+Java_org_iotivity_ca_CaLeServerInterface_caLeGattServerConnectionStateChangeCallback(
JNIEnv *env, jobject obj, jobject device, jint status, jint newState)
{
- OIC_LOG(DEBUG, TAG, "caleserverinterface - Gatt Server ConnectionStateChange Callback");
+ OIC_LOG(DEBUG, TAG, "CaLeServerInterface - Gatt Server ConnectionStateChange Callback");
OIC_LOG_V(DEBUG, TAG, "New connection State: %d", newState);
VERIFY_NON_NULL_VOID(env, TAG, "env is null");
}
JNIEXPORT void JNICALL
-Java_org_iotivity_jar_caleserverinterface_CALeGattServerServiceAddedCallback(JNIEnv *env,
+Java_org_iotivity_ca_CaLeServerInterface_caLeGattServerServiceAddedCallback(JNIEnv *env,
jobject obj,
jint status,
jobject gattService)
{
- OIC_LOG_V(DEBUG, TAG, "caleserverinterface - Gatt Service Added Callback(%d)", status);
+ OIC_LOG_V(DEBUG, TAG, "CaLeServerInterface - Gatt Service Added Callback(%d)", status);
}
JNIEXPORT void JNICALL
-Java_org_iotivity_jar_caleserverinterface_CALeGattServerCharacteristicReadRequestCallback(
+Java_org_iotivity_ca_CaLeServerInterface_caLeGattServerCharacteristicReadRequestCallback(
JNIEnv *env, jobject obj, jobject device, jint requestId, jint offset,
jobject characteristic, jbyteArray data)
{
- OIC_LOG(DEBUG, TAG, "caleserverinterface - Gatt Server Characteristic Read Request Callback");
+ OIC_LOG(DEBUG, TAG, "CaLeServerInterface - Gatt Server Characteristic Read Request Callback");
VERIFY_NON_NULL_VOID(env, TAG, "env is null");
VERIFY_NON_NULL_VOID(device, TAG, "device is null");
}
JNIEXPORT void JNICALL
-Java_org_iotivity_jar_caleserverinterface_CALeGattServerCharacteristicWriteRequestCallback(
+Java_org_iotivity_ca_CaLeServerInterface_caLeGattServerCharacteristicWriteRequestCallback(
JNIEnv *env, jobject obj, jobject device, jint requestId, jobject characteristic,
jbyteArray data, jboolean preparedWrite, jboolean responseNeeded, jint offset,
jbyteArray value)
{
- OIC_LOG(DEBUG, TAG, "caleserverinterface - Gatt Server Characteristic Write Request Callback");
+ OIC_LOG(DEBUG, TAG, "CaLeServerInterface - Gatt Server Characteristic Write Request Callback");
VERIFY_NON_NULL_VOID(env, TAG, "env is null");
VERIFY_NON_NULL_VOID(device, TAG, "device is null");
VERIFY_NON_NULL_VOID(value, TAG, "value is null");
}
JNIEXPORT void JNICALL
-Java_org_iotivity_jar_caleserverinterface_CALeGattServerDescriptorReadRequestCallback(
+Java_org_iotivity_ca_CaLeServerInterface_caLeGattServerDescriptorReadRequestCallback(
JNIEnv *env, jobject obj, jobject device, jint requestId, jint offset, jobject descriptor)
{
- OIC_LOG(DEBUG, TAG, "caleserverinterface_CALeGattServerDescriptorReadRequestCallback");
+ OIC_LOG(DEBUG, TAG, "CaLeServerInterface_CALeGattServerDescriptorReadRequestCallback");
}
JNIEXPORT void JNICALL
-Java_org_iotivity_jar_caleserverinterface_CALeGattServerDescriptorWriteRequestCallback(
+Java_org_iotivity_ca_CaLeServerInterface_caLeGattServerDescriptorWriteRequestCallback(
JNIEnv *env, jobject obj, jobject device, jint requestId, jobject descriptor,
jboolean preparedWrite, jboolean responseNeeded, jint offset, jbyteArray value)
{
- OIC_LOG(DEBUG, TAG, "caleserverinterface_CALeGattServerDescriptorWriteRequestCallback");
+ OIC_LOG(DEBUG, TAG, "CaLeServerInterface_CALeGattServerDescriptorWriteRequestCallback");
}
JNIEXPORT void JNICALL
-Java_org_iotivity_jar_caleserverinterface_CALeGattServerExecuteWriteCallback(JNIEnv *env,
+Java_org_iotivity_ca_CaLeServerInterface_caLeGattServerExecuteWriteCallback(JNIEnv *env,
jobject obj,
jobject device,
jint requestId,
jboolean execute)
{
- OIC_LOG(DEBUG, TAG, "caleserverinterface_CALeGattServerExecuteWriteCallback");
+ OIC_LOG(DEBUG, TAG, "CaLeServerInterface_CALeGattServerExecuteWriteCallback");
VERIFY_NON_NULL_VOID(env, TAG, "env is null");
VERIFY_NON_NULL_VOID(device, TAG, "device is null");
}
JNIEXPORT void JNICALL
-Java_org_iotivity_jar_caleserverinterface_CALeGattServerNotificationSentCallback(JNIEnv *env,
+Java_org_iotivity_ca_CaLeServerInterface_caLeGattServerNotificationSentCallback(JNIEnv *env,
jobject obj,
jobject device,
jint status)
{
- OIC_LOG(DEBUG, TAG, "caleserverinterface - Gatt Server Notification Sent Callback");
+ OIC_LOG(DEBUG, TAG, "CaLeServerInterface - Gatt Server Notification Sent Callback");
}
JNIEXPORT void JNICALL
-Java_org_iotivity_jar_caleserverinterface_CALeAdvertiseStartSuccessCallback(
+Java_org_iotivity_ca_CaLeServerInterface_caLeAdvertiseStartSuccessCallback(
JNIEnv *env, jobject obj, jobject settingsInEffect)
{
- OIC_LOG(DEBUG, TAG, "caleserverinterface - LE Advertise Start Success Callback");
+ OIC_LOG(DEBUG, TAG, "CaLeServerInterface - LE Advertise Start Success Callback");
}
JNIEXPORT void JNICALL
-Java_org_iotivity_jar_caleserverinterface_CALeAdvertiseStartFailureCallback(JNIEnv *env,
+Java_org_iotivity_ca_CaLeServerInterface_caLeAdvertiseStartFailureCallback(JNIEnv *env,
jobject obj,
jint errorCode)
{
- OIC_LOG_V(ERROR, TAG, "caleserverinterface - LE Advertise Start Failure Callback(%)",
+ OIC_LOG_V(ERROR, TAG, "CaLeServerInterface - LE Advertise Start Failure Callback(%)",
errorCode);
}
--- /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.
+ *
+ ******************************************************************/
+
+#include <jni.h>
+/* Header for class org_iotivity_ca_caLeClientInterface */
+
+#ifndef CA_Included_org_iotivity_ca_caLeClientInterface_H_
+#define CA_Included_org_iotivity_ca_caLeClientInterface_H_
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+/*
+ * Class: org_iotivity_ca_caLeClientInterface
+ * Method: caLeRegisterLeScanCallback
+ * Signature: (Landroid/bluetooth/BluetoothAdapter/LeScanCallback;)V
+ */
+JNIEXPORT void JNICALL
+Java_org_iotivity_ca_caLeClientInterface_caLeRegisterLeScanCallback
+(JNIEnv *, jobject, jobject);
+
+/*
+ * Class: org_iotivity_ca_caLeClientInterface
+ * Method: caLeRegisterGattCallback
+ * Signature: (Landroid/bluetooth/BluetoothGattCallback;)V
+ */
+JNIEXPORT void JNICALL
+Java_org_iotivity_ca_caLeClientInterface_caLeRegisterGattCallback
+(JNIEnv *, jobject, jobject);
+
+/*
+ * Class: org_iotivity_ca_caLeClientInterface
+ * Method: caLeScanCallback
+ * Signature: (Landroid/bluetooth/BluetoothDevice;I[B)V
+ */
+JNIEXPORT void JNICALL
+Java_org_iotivity_ca_caLeClientInterface_caLeScanCallback
+(JNIEnv *, jobject, jobject, jint, jbyteArray);
+
+/*
+ * Class: org_iotivity_ca_caLeClientInterface
+ * Method: caLeGattConnectionStateChangeCallback
+ * Signature: (Landroid/bluetooth/BluetoothGatt;II)V
+ */
+JNIEXPORT void JNICALL
+Java_org_iotivity_ca_caLeClientInterface_caLeGattConnectionStateChangeCallback
+(JNIEnv *, jobject, jobject, jint, jint);
+
+/*
+ * Class: org_iotivity_ca_caLeClientInterface
+ * Method: caLeGattServicesDiscoveredCallback
+ * Signature: (Landroid/bluetooth/BluetoothGatt;I)V
+ */
+JNIEXPORT void JNICALL
+Java_org_iotivity_ca_caLeClientInterface_caLeGattServicesDiscoveredCallback
+(JNIEnv *, jobject, jobject, jint);
+
+/*
+ * Class: org_iotivity_ca_caLeClientInterface
+ * Method: caLeGattCharacteristicReadCallback
+ * Signature: (Landroid/bluetooth/BluetoothGatt;Landroid/bluetooth/BluetoothGattCharacteristic;I)V
+ */
+JNIEXPORT void JNICALL
+Java_org_iotivity_ca_caLeClientInterface_caLeGattCharacteristicReadCallback
+(JNIEnv *, jobject, jobject, jobject, jbyteArray, jint);
+
+/*
+ * Class: org_iotivity_ca_caLeClientInterface
+ * Method: caLeGattCharacteristicWritjclasseCallback
+ * Signature: (Landroid/bluetooth/BluetoothGatt;Landroid/bluetooth/BluetoothGattCharacteristic;I)V
+ */
+JNIEXPORT void JNICALL
+Java_org_iotivity_ca_caLeClientInterface_caLeGattCharacteristicWriteCallback
+(JNIEnv *, jobject, jobject, jobject, jbyteArray, jint);
+
+/*
+ * Class: org_iotivity_ca_caLeClientInterface
+ * Method: caLeGattCharacteristicChangedCallback
+ * Signature: (Landroid/bluetooth/BluetoothGatt;Landroid/bluetooth/BluetoothGattCharacteristic;)V
+ */
+JNIEXPORT void JNICALL
+Java_org_iotivity_ca_caLeClientInterface_caLeGattCharacteristicChangedCallback
+(JNIEnv *, jobject, jobject, jobject, jbyteArray);
+
+/*
+ * Class: org_iotivity_ca_caLeClientInterface
+ * Method: caLeGattDescriptorReadCallback
+ * Signature: (Landroid/bluetooth/BluetoothGatt;Landroid/bluetooth/BluetoothGattDescriptor;I)V
+ */
+JNIEXPORT void JNICALL
+Java_org_iotivity_ca_caLeClientInterface_caLeGattDescriptorReadCallback
+(JNIEnv *, jobject, jobject, jobject, jint);
+
+/*
+ * Class: org_iotivity_ca_caLeClientInterface
+ * Method: caLeGattDescriptorWriteCallback
+ * Signature: (Landroid/bluetooth/BluetoothGatt;Landroid/bluetooth/BluetoothGattDescriptor;I)V
+ */
+JNIEXPORT void JNICALL
+Java_org_iotivity_ca_caLeClientInterface_caLeGattDescriptorWriteCallback
+(JNIEnv *, jobject, jobject, jobject, jint);
+
+/*
+ * Class: org_iotivity_ca_caLeClientInterface
+ * Method: caLeGattReliableWriteCompletedCallback
+ * Signature: (Landroid/bluetooth/BluetoothGatt;I)V
+ */
+JNIEXPORT void JNICALL
+Java_org_iotivity_ca_caLeClientInterface_caLeGattReliableWriteCompletedCallback
+(JNIEnv *, jobject, jobject, jint);
+
+/*
+ * Class: org_iotivity_ca_caLeClientInterface
+ * Method: caLeGattReadRemoteRssiCallback
+ * Signature: (Landroid/bluetooth/BluetoothGatt;II)V
+ */
+JNIEXPORT void JNICALL
+Java_org_iotivity_ca_caLeClientInterface_caLeGattReadRemoteRssiCallback
+(JNIEnv *, jobject, jobject, jint, jint);
+
+/*
+ * Class: org_iotivity_ca_caLeClientInterface
+ * Method: caLeStateChangedCallback
+ * Signature: (I)V
+ */
+JNIEXPORT void JNICALL
+Java_org_iotivity_ca_caLeClientInterface_caLeStateChangedCallback
+(JNIEnv *, jobject, jint);
+
+/*
+ * Class: org_iotivity_ca_caLeClientInterface
+ * Method: caLeBondStateChangedCallback
+ * Signature: (I)V
+ */
+JNIEXPORT void JNICALL
+Java_org_iotivity_ca_caLeClientInterface_caLeBondStateChangedCallback
+(JNIEnv *, jobject, jstring);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
+
--- /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.
+ *
+ ******************************************************************/
+
+#include <jni.h>
+/* Header for class org_iotivity_ca_caLeServerInterface */
+
+#ifndef CA_Included_org_iotivity_ca_caLeServerInterface_H_
+#define CA_Included_org_iotivity_ca_caLeServerInterface_H_
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+/*
+ * Class: org_iotivity_ca_caLeServerInterface
+ * Method: caLeRegisterGattServerCallback
+ * Signature: (Landroid/bluetooth/BluetoothGattServerCallback;)V
+ */
+JNIEXPORT void JNICALL
+
+Java_org_iotivity_ca_caLeServerInterface_caLeRegisterGattServerCallback
+(JNIEnv *, jobject, jobject);
+
+/*
+ * Class: org_iotivity_ca_caLeServerInterface
+ * Method: caLeRegisterBluetoothLeAdvertiseCallback
+ * Signature: (Landroid/bluetooth/le/AdvertiseCallback;)V
+ */
+JNIEXPORT void JNICALL
+Java_org_iotivity_ca_caLeServerInterface_caLeRegisterBluetoothLeAdvertiseCallback
+(JNIEnv *, jobject, jobject);
+
+/*
+ * Class: org_iotivity_ca_caLeServerInterface
+ * Method: caLeGattServerConnectionStateChangeCallback
+ * Signature: (Landroid/bluetooth/BluetoothDevice;II)V
+ */
+JNIEXPORT void JNICALL
+Java_org_iotivity_ca_caLeServerInterface_caLeGattServerConnectionStateChangeCallback
+(JNIEnv *, jobject, jobject, jint, jint);
+
+/*
+ * Class: org_iotivity_ca_caLeServerInterface
+ * Method: caLeGattServerServiceAddedCallback
+ * Signature: (ILandroid/bluetooth/BluetoothGattService;)V
+ */
+JNIEXPORT void JNICALL
+Java_org_iotivity_ca_caLeServerInterface_caLeGattServerServiceAddedCallback
+(JNIEnv *, jobject, jint, jobject);
+
+/*
+ * Class: org_iotivity_ca_caLeServerInterface
+ * Method: caLeGattServerCharacteristicReadRequestCallback
+ * Signature: (Landroid/bluetooth/BluetoothDevice;IILandroid/
+ * bluetooth/BluetoothGattCharacteristic;)V
+ */
+JNIEXPORT void JNICALL
+Java_org_iotivity_ca_caLeServerInterface_caLeGattServerCharacteristicReadRequestCallback
+(JNIEnv *, jobject, jobject, jint, jint, jobject, jbyteArray);
+
+/*
+ * Class: org_iotivity_ca_caLeServerInterface
+ * Method: caLeGattServerCharacteristicWriteRequestCallback
+ * Signature: (Landroid/bluetooth/BluetoothDevice;ILandroid/bluetooth/
+ * BluetoothGattCharacteristic;ZZI[B)V
+ */
+JNIEXPORT void JNICALL
+Java_org_iotivity_ca_caLeServerInterface_caLeGattServerCharacteristicWriteRequestCallback
+(JNIEnv *, jobject, jobject, jint, jobject, jbyteArray, jboolean, jboolean, jint, jbyteArray);
+
+/*
+ * Class: org_iotivity_ca_caLeServerInterface
+ * Method: caLeGattServerDescriptorReadRequestCallback
+ * Signature: (Landroid/bluetooth/BluetoothDevice;IILandroid/bluetooth/
+ * BluetoothGattDescriptor;)V
+ */
+JNIEXPORT void JNICALL
+Java_org_iotivity_ca_caLeServerInterface_caLeGattServerDescriptorReadRequestCallback
+(JNIEnv *, jobject, jobject, jint, jint, jobject);
+
+/*
+ * Class: org_iotivity_ca_caLeServerInterface
+ * Method: caLeGattServerDescriptorWriteRequestCallback
+ * Signature: (Landroid/bluetooth/BluetoothDevice;ILandroid/bluetooth/
+ * BluetoothGattDescriptor;ZZI[B)V
+ */
+JNIEXPORT void JNICALL
+Java_org_iotivity_ca_caLeServerInterface_caLeGattServerDescriptorWriteRequestCallback
+(JNIEnv *, jobject, jobject, jint, jobject, jboolean, jboolean, jint, jbyteArray);
+
+/*
+ * Class: org_iotivity_ca_caLeServerInterface
+ * Method: caLeGattServerExecuteWriteCallback
+ * Signature: (Landroid/bluetooth/BluetoothDevice;IZ)V
+ */
+JNIEXPORT void JNICALL
+Java_org_iotivity_ca_caLeServerInterface_caLeGattServerExecuteWriteCallback
+(JNIEnv *, jobject, jobject, jint, jboolean);
+
+/*
+ * Class: org_iotivity_ca_caLeServerInterface
+ * Method: caLeGattServerNotificationSentCallback
+ * Signature: (Landroid/bluetooth/BluetoothDevice;I)V
+ */
+JNIEXPORT void JNICALL
+Java_org_iotivity_ca_caLeServerInterface_caLeGattServerNotificationSentCallback
+(JNIEnv *, jobject, jobject, jint);
+
+/*
+ * Class: org_iotivity_ca_caLeServerInterface
+ * Method: caLeAdvertiseStartSuccessCallback
+ * Signature: (Landroid/bluetooth/le/AdvertiseSettings;)V
+ */
+JNIEXPORT void JNICALL
+Java_org_iotivity_ca_caLeServerInterface_caLeAdvertiseStartSuccessCallback
+(JNIEnv *, jobject, jobject);
+
+/*
+ * Class: org_iotivity_ca_caLeServerInterface
+ * Method: caLeAdvertiseStartFailureCallback
+ * Signature: (I)V
+ */
+JNIEXPORT void JNICALL
+Java_org_iotivity_ca_caLeServerInterface_caLeAdvertiseStartFailureCallback
+(JNIEnv *, jobject, jint);
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif
+
+++ /dev/null
-#include <jni.h>
-/* Header for class org_iotivity_jar_caleclientinterface */
-
-#ifndef CA_Included_org_iotivity_jar_caleclientinterface_H_
-#define CA_Included_org_iotivity_jar_caleclientinterface_H_
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
-/*
- * Class: org_iotivity_jar_caleclientinterface
- * Method: CARegisterLeScanCallback
- * Signature: (Landroid/bluetooth/BluetoothAdapter/LeScanCallback;)V
- */
-JNIEXPORT void JNICALL
-Java_org_iotivity_jar_caleclientinterface_CARegisterLeScanCallback
-(JNIEnv *, jobject, jobject);
-
-/*
- * Class: org_iotivity_jar_caleclientinterface
- * Method: CARegisterLeGattCallback
- * Signature: (Landroid/bluetooth/BluetoothGattCallback;)V
- */
-JNIEXPORT void JNICALL
-Java_org_iotivity_jar_caleclientinterface_CARegisterLeGattCallback
-(JNIEnv *, jobject, jobject);
-
-/*
- * Class: org_iotivity_jar_caleclientinterface
- * Method: CALeScanCallback
- * Signature: (Landroid/bluetooth/BluetoothDevice;I[B)V
- */
-JNIEXPORT void JNICALL
-Java_org_iotivity_jar_caleclientinterface_CALeScanCallback
-(JNIEnv *, jobject, jobject, jint, jbyteArray);
-
-/*
- * Class: org_iotivity_jar_caleclientinterface
- * Method: CALeGattConnectionStateChangeCallback
- * Signature: (Landroid/bluetooth/BluetoothGatt;II)V
- */
-JNIEXPORT void JNICALL
-Java_org_iotivity_jar_caleclientinterface_CALeGattConnectionStateChangeCallback
-(JNIEnv *, jobject, jobject, jint, jint);
-
-/*
- * Class: org_iotivity_jar_caleclientinterface
- * Method: CALeGattServicesDiscoveredCallback
- * Signature: (Landroid/bluetooth/BluetoothGatt;I)V
- */
-JNIEXPORT void JNICALL
-Java_org_iotivity_jar_caleclientinterface_CALeGattServicesDiscoveredCallback
-(JNIEnv *, jobject, jobject, jint);
-
-/*
- * Class: org_iotivity_jar_caleclientinterface
- * Method: CALeGattCharacteristicReadCallback
- * Signature: (Landroid/bluetooth/BluetoothGatt;Landroid/bluetooth/BluetoothGattCharacteristic;I)V
- */
-JNIEXPORT void JNICALL
-Java_org_iotivity_jar_caleclientinterface_CALeGattCharacteristicReadCallback
-(JNIEnv *, jobject, jobject, jobject, jbyteArray, jint);
-
-/*
- * Class: org_iotivity_jar_caleclientinterface
- * Method: CALeGattCharacteristicWritjclasseCallback
- * Signature: (Landroid/bluetooth/BluetoothGatt;Landroid/bluetooth/BluetoothGattCharacteristic;I)V
- */
-JNIEXPORT void JNICALL
-Java_org_iotivity_jar_caleclientinterface_CALeGattCharacteristicWriteCallback
-(JNIEnv *, jobject, jobject, jobject, jbyteArray, jint);
-
-/*
- * Class: org_iotivity_jar_caleclientinterface
- * Method: CALeGattCharacteristicChangedCallback
- * Signature: (Landroid/bluetooth/BluetoothGatt;Landroid/bluetooth/BluetoothGattCharacteristic;)V
- */
-JNIEXPORT void JNICALL
-Java_org_iotivity_jar_caleclientinterface_CALeGattCharacteristicChangedCallback
-(JNIEnv *, jobject, jobject, jobject, jbyteArray);
-
-/*
- * Class: org_iotivity_jar_caleclientinterface
- * Method: CALeGattDescriptorReadCallback
- * Signature: (Landroid/bluetooth/BluetoothGatt;Landroid/bluetooth/BluetoothGattDescriptor;I)V
- */
-JNIEXPORT void JNICALL
-Java_org_iotivity_jar_caleclientinterface_CALeGattDescriptorReadCallback
-(JNIEnv *, jobject, jobject, jobject, jint);
-
-/*
- * Class: org_iotivity_jar_caleclientinterface
- * Method: CALeGattDescriptorWriteCallback
- * Signature: (Landroid/bluetooth/BluetoothGatt;Landroid/bluetooth/BluetoothGattDescriptor;I)V
- */
-JNIEXPORT void JNICALL
-Java_org_iotivity_jar_caleclientinterface_CALeGattDescriptorWriteCallback
-(JNIEnv *, jobject, jobject, jobject, jint);
-
-/*
- * Class: org_iotivity_jar_caleclientinterface
- * Method: CALeGattReliableWriteCompletedCallback
- * Signature: (Landroid/bluetooth/BluetoothGatt;I)V
- */
-JNIEXPORT void JNICALL
-Java_org_iotivity_jar_caleclientinterface_CALeGattReliableWriteCompletedCallback
-(JNIEnv *, jobject, jobject, jint);
-
-/*
- * Class: org_iotivity_jar_caleclientinterface
- * Method: CALeGattReadRemoteRssiCallback
- * Signature: (Landroid/bluetooth/BluetoothGatt;II)V
- */
-JNIEXPORT void JNICALL
-Java_org_iotivity_jar_caleclientinterface_CALeGattReadRemoteRssiCallback
-(JNIEnv *, jobject, jobject, jint, jint);
-
-/*
- * Class: org_iotivity_jar_caleclientinterface
- * Method: CALeStateChangedCallback
- * Signature: (I)V
- */
-JNIEXPORT void JNICALL
-Java_org_iotivity_jar_caleclientinterface_CALeStateChangedCallback
-(JNIEnv *, jobject, jint);
-
-/*
- * Class: org_iotivity_jar_caleclientinterface
- * Method: CALeBondStateChangedCallback
- * Signature: (I)V
- */
-JNIEXPORT void JNICALL
-Java_org_iotivity_jar_caleclientinterface_CALeBondStateChangedCallback
-(JNIEnv *, jobject, jstring);
-
-#ifdef __cplusplus
-}
-#endif
-#endif
-
+++ /dev/null
-#include <jni.h>
-/* Header for class org_iotivity_jar_caleserverinterface */
-
-#ifndef CA_Included_org_iotivity_jar_caleserverinterface_H_
-#define CA_Included_org_iotivity_jar_caleserverinterface_H_
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
-/*
- * Class: org_iotivity_jar_caleserverinterface
- * Method: CARegisterLeGattServerCallback
- * Signature: (Landroid/bluetooth/BluetoothGattServerCallback;)V
- */
-JNIEXPORT void JNICALL
-
-Java_org_iotivity_jar_caleserverinterface_CARegisterLeGattServerCallback
-(JNIEnv *, jobject, jobject);
-
-/*
- * Class: org_iotivity_jar_caleserverinterface
- * Method: CARegisterBluetoothLeAdvertiseCallback
- * Signature: (Landroid/bluetooth/le/AdvertiseCallback;)V
- */
-JNIEXPORT void JNICALL
-Java_org_iotivity_jar_caleserverinterface_CARegisterBluetoothLeAdvertiseCallback
-(JNIEnv *, jobject, jobject);
-
-/*
- * Class: org_iotivity_jar_caleserverinterface
- * Method: CALeGattServerConnectionStateChangeCallback
- * Signature: (Landroid/bluetooth/BluetoothDevice;II)V
- */
-JNIEXPORT void JNICALL
-Java_org_iotivity_jar_caleserverinterface_CALeGattServerConnectionStateChangeCallback
-(JNIEnv *, jobject, jobject, jint, jint);
-
-/*
- * Class: org_iotivity_jar_caleserverinterface
- * Method: CALeGattServerServiceAddedCallback
- * Signature: (ILandroid/bluetooth/BluetoothGattService;)V
- */
-JNIEXPORT void JNICALL
-Java_org_iotivity_jar_caleserverinterface_CALeGattServerServiceAddedCallback
-(JNIEnv *, jobject, jint, jobject);
-
-/*
- * Class: org_iotivity_jar_caleserverinterface
- * Method: CALeGattServerCharacteristicReadRequestCallback
- * Signature: (Landroid/bluetooth/BluetoothDevice;IILandroid/
- * bluetooth/BluetoothGattCharacteristic;)V
- */
-JNIEXPORT void JNICALL
-Java_org_iotivity_jar_caleserverinterface_CALeGattServerCharacteristicReadRequestCallback
-(JNIEnv *, jobject, jobject, jint, jint, jobject, jbyteArray);
-
-/*
- * Class: org_iotivity_jar_caleserverinterface
- * Method: CALeGattServerCharacteristicWriteRequestCallback
- * Signature: (Landroid/bluetooth/BluetoothDevice;ILandroid/bluetooth/
- * BluetoothGattCharacteristic;ZZI[B)V
- */
-JNIEXPORT void JNICALL
-Java_org_iotivity_jar_caleserverinterface_CALeGattServerCharacteristicWriteRequestCallback
-(JNIEnv *, jobject, jobject, jint, jobject, jbyteArray, jboolean, jboolean, jint, jbyteArray);
-
-/*
- * Class: org_iotivity_jar_caleserverinterface
- * Method: CALeGattServerDescriptorReadRequestCallback
- * Signature: (Landroid/bluetooth/BluetoothDevice;IILandroid/bluetooth/
- * BluetoothGattDescriptor;)V
- */
-JNIEXPORT void JNICALL
-Java_org_iotivity_jar_caleserverinterface_CALeGattServerDescriptorReadRequestCallback
-(JNIEnv *, jobject, jobject, jint, jint, jobject);
-
-/*
- * Class: org_iotivity_jar_caleserverinterface
- * Method: CALeGattServerDescriptorWriteRequestCallback
- * Signature: (Landroid/bluetooth/BluetoothDevice;ILandroid/bluetooth/
- * BluetoothGattDescriptor;ZZI[B)V
- */
-JNIEXPORT void JNICALL
-Java_org_iotivity_jar_caleserverinterface_CALeGattServerDescriptorWriteRequestCallback
-(JNIEnv *, jobject, jobject, jint, jobject, jboolean, jboolean, jint, jbyteArray);
-
-/*
- * Class: org_iotivity_jar_caleserverinterface
- * Method: CALeGattServerExecuteWriteCallback
- * Signature: (Landroid/bluetooth/BluetoothDevice;IZ)V
- */
-JNIEXPORT void JNICALL
-Java_org_iotivity_jar_caleserverinterface_CALeGattServerExecuteWriteCallback
-(JNIEnv *, jobject, jobject, jint, jboolean);
-
-/*
- * Class: org_iotivity_jar_caleserverinterface
- * Method: CALeGattServerNotificationSentCallback
- * Signature: (Landroid/bluetooth/BluetoothDevice;I)V
- */
-JNIEXPORT void JNICALL
-Java_org_iotivity_jar_caleserverinterface_CALeGattServerNotificationSentCallback
-(JNIEnv *, jobject, jobject, jint);
-
-/*
- * Class: org_iotivity_jar_caleserverinterface
- * Method: CALeAdvertiseStartSuccessCallback
- * Signature: (Landroid/bluetooth/le/AdvertiseSettings;)V
- */
-JNIEXPORT void JNICALL
-Java_org_iotivity_jar_caleserverinterface_CALeAdvertiseStartSuccessCallback
-(JNIEnv *, jobject, jobject);
-
-/*
- * Class: org_iotivity_jar_caleserverinterface
- * Method: CALeAdvertiseStartFailureCallback
- * Signature: (I)V
- */
-JNIEXPORT void JNICALL
-Java_org_iotivity_jar_caleserverinterface_CALeAdvertiseStartFailureCallback
-(JNIEnv *, jobject, jint);
-
-
-#ifdef __cplusplus
-}
-#endif
-#endif
-
static CAResult_t CAIPUpdateInterfaceInformation(u_arraylist_t **netInterfaceList);
/**
* @fn CACreateIPJNIInterfaceObject
- * @brief creates new instance of caipinterface through JNI
+ * @brief creates new instance of CaIpInterface through JNI
*/
static CAResult_t CACreateIPJNIInterfaceObject(jobject context);
return CA_STATUS_FAILED;
}
- //Create caipinterface jni instance
+ //Create CaIpInterface jni instance
jclass IPJniInterface = (*env)->FindClass(env, "org/iotivity/ca/CaIpInterface");
if (!IPJniInterface)
{
- OIC_LOG(ERROR, IP_MONITOR_TAG, "Could not get caipinterface class");
+ OIC_LOG(ERROR, IP_MONITOR_TAG, "Could not get CaIpInterface class");
return CA_STATUS_FAILED;
}
"(Landroid/content/Context;)V");
if (!IPInterfaceConstructorMethod)
{
- OIC_LOG(ERROR, IP_MONITOR_TAG, "Could not get caipinterface constructor method");
+ OIC_LOG(ERROR, IP_MONITOR_TAG, "Could not get CaIpInterface constructor method");
return CA_STATUS_FAILED;
}
(*env)->NewObject(env, IPJniInterface, IPInterfaceConstructorMethod, gApplicationContext);
- OIC_LOG(DEBUG, IP_MONITOR_TAG, "Create caipinterface instance, success");
+ OIC_LOG(DEBUG, IP_MONITOR_TAG, "Create CaIpInterface instance, success");
OIC_LOG(DEBUG, IP_MONITOR_TAG, "OUT");
return CA_STATUS_OK;
ret = CACreateIPJNIInterfaceObject(g_context);
if (CA_STATUS_OK != ret)
{
- OIC_LOG(ERROR, IP_MONITOR_TAG, "unable to create caipinterface instance");
+ OIC_LOG(ERROR, IP_MONITOR_TAG, "unable to create CaIpInterface instance");
return ret;
}
ca_mutex_unlock(g_stopNetworkMonitorMutex);
return;
}
+
ca_mutex_unlock(g_stopNetworkMonitorMutex);
+
ca_mutex_lock(g_networkMonitorContextMutex);
- if(!g_networkMonitorContext)
+
+ if (!g_networkMonitorContext)
{
- OIC_LOG(DEBUG, IP_MONITOR_TAG, "g_networkChangeCb is NULL");
- ca_mutex_unlock(g_networkMonitorContextMutex);
- return;
+ OIC_LOG(ERROR, IP_MONITOR_TAG, "g_networkMonitorContext is NULL");
+ ca_mutex_unlock(g_networkMonitorContextMutex);
+ return;
}
+
if (!g_networkMonitorContext->networkChangeCb)
- {
- OIC_LOG(ERROR, IP_MONITOR_TAG, "g_networkChangeCb->networkChangeCb is NULL");
+ {
+ OIC_LOG(ERROR, IP_MONITOR_TAG, "g_networkMonitorContext->networkChangeCb is NULL");
ca_mutex_unlock(g_networkMonitorContextMutex);
return;
}
ca_mutex_unlock(g_networkMonitorContextMutex);
-
+
u_arraylist_t *netInterfaceList = u_arraylist_create();
VERIFY_NON_NULL_VOID(netInterfaceList, IP_MONITOR_TAG,
OIC_LOG(DEBUG, IP_MONITOR_TAG, "OUT");
}
-JNIEXPORT void JNICALL Java_org_iotivity_ca_CaIpInterface_stateEnabled
- (JNIEnv *env, jclass clazz)
+JNIEXPORT void JNICALL
+Java_org_iotivity_ca_CaIpInterface_caIpStateEnabled(JNIEnv *env, jclass class)
{
CANetworkStatus_t currNetworkStatus = CA_INTERFACE_UP;
- OIC_LOG(DEBUG, IP_MONITOR_TAG, "CAIPStateEnabled");
+ OIC_LOG(DEBUG, IP_MONITOR_TAG, "caIpStateEnabled");
CAIPSendNetworkChangeCallback(currNetworkStatus);
}
-JNIEXPORT void JNICALL Java_org_iotivity_ca_CaIpInterface_stateDisabled
- (JNIEnv *env, jclass clazz)
+JNIEXPORT void JNICALL
+Java_org_iotivity_ca_CaIpInterface_caIpStateDisabled(JNIEnv *env, jclass class)
{
CANetworkStatus_t currNetworkStatus = CA_INTERFACE_DOWN;
- OIC_LOG(DEBUG, IP_MONITOR_TAG, "CAIPStateDisabled");
+ OIC_LOG(DEBUG, IP_MONITOR_TAG, "caIpStateDisabled");
CAIPSendNetworkChangeCallback(currNetworkStatus);
}
-/* DO NOT EDIT THIS FILE - it is machine generated */\r
+/******************************************************************\r
+ *\r
+ * Copyright 2014 Samsung Electronics All Rights Reserved.\r
+ *\r
+ *\r
+ *\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ *\r
+ ******************************************************************/\r
+\r
#include <jni.h>\r
/* Header for class org_iotivity_ca_CaIpInterface */\r
\r
#ifndef _Included_org_iotivity_ca_CaIpInterface\r
#define _Included_org_iotivity_ca_CaIpInterface\r
#ifdef __cplusplus\r
-extern "C" {\r
+extern "C"\r
+{\r
#endif\r
/*\r
- * Class: org_iotivity_ca_CaIpInterface\r
- * Method: stateEnabled\r
+ * Class: org_iotivity_ca_caIpInterface\r
+ * Method: CaIpStateEnabled\r
* Signature: ()V\r
*/\r
-JNIEXPORT void JNICALL Java_org_iotivity_ca_CaIpInterface_stateEnabled\r
- (JNIEnv *, jclass);\r
+JNIEXPORT void JNICALL\r
+Java_org_iotivity_ca_CaIpInterface_caIpStateEnabled(JNIEnv *, jclass);\r
\r
/*\r
- * Class: org_iotivity_ca_CaIpInterface\r
- * Method: stateDisabled\r
+ * Class: org_iotivity_ca_caIpInterface\r
+ * Method: CaIpStateDisabled\r
* Signature: ()V\r
*/\r
-JNIEXPORT void JNICALL Java_org_iotivity_ca_CaIpInterface_stateDisabled\r
- (JNIEnv *, jclass);\r
+JNIEXPORT void JNICALL\r
+Java_org_iotivity_ca_CaIpInterface_caIpStateDisabled(JNIEnv *, jclass);\r
\r
#ifdef __cplusplus\r
}\r