1 /* ****************************************************************
3 * Copyright 2016 Samsung Electronics All Rights Reserved.
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
19 ******************************************************************/
21 #ifndef CA_UTILS_INTERFACE_H_
22 #define CA_UTILS_INTERFACE_H_
34 * Callback function type for connection status changes delivery.
36 typedef void (*CAConnectionStateChangedCB)(CATransportAdapter_t adapter,
37 const char *remote_address, bool connected);
40 * Callback function type for adapter status changes delivery.
41 * @param[out] adapter Transport type information.
42 * @param[out] enabled Current adapter status info.
44 typedef void (*CAAdapterStateChangedCB)(CATransportAdapter_t adapter, bool enabled);
47 * Register network monitoring callback.
48 * Network status changes are delivered these callback.
49 * @param[in] adapterStateCB Adapter state monitoring callback.
50 * @param[in] connStateCB Connection state monitoring callback.
52 * @return ::CA_STATUS_OK or ::CA_STATUS_FAILED or ::CA_MEMORY_ALLOC_FAILED
54 CAResult_t CARegisterNetworkMonitorHandler(CAAdapterStateChangedCB adapterStateCB,
55 CAConnectionStateChangedCB connStateCB);
58 * Set device to handle for auto connection.
59 * @param[in] address LE address to set.
61 * @return ::CA_STATUS_OK or ::CA_STATUS_FAILED.
63 CAResult_t CASetAutoConnectionDeviceInfo(const char* address);
66 * Unset device to handle for auto connection.
67 * @param[in] address LE address to unset.
69 * @return ::CA_STATUS_OK or ::CA_STATUS_FAILED.
71 CAResult_t CAUnsetAutoConnectionDeviceInfo(const char* address);
75 * initialize util client for android
76 * @param[in] env JNI interface pointer.
77 * @param[in] jvm invocation inferface for JAVA virtual machine.
78 * @param[in] context application context.
80 * @return ::CA_STATUS_OK or ::CA_STATUS_FAILED or ::CA_MEMORY_ALLOC_FAILED
82 CAResult_t CAUtilClientInitialize(JNIEnv *env, JavaVM *jvm, jobject context);
85 * terminate util client for android
86 * @param[in] env JNI interface pointer.
88 * @return ::CA_STATUS_OK or ::CA_STATUS_FAILED or ::CA_MEMORY_ALLOC_FAILED
90 CAResult_t CAUtilClientTerminate(JNIEnv *env);
94 * start discovery for BT device which has iotivity UUID.
95 * @param[in] env JNI interface pointer.
97 CAResult_t CAUtilStartScan(JNIEnv *env);
101 * @param[in] env JNI interface pointer.
103 CAResult_t CAUtilStopScan(JNIEnv *env);
106 * bonding between devices.
107 * @param[in] env JNI interface pointer.
108 * @param[in] device bluetooth device object.
110 CAResult_t CAUtilCreateBond(JNIEnv *env, jobject device);
114 * set callback listener of found device.
115 * @param[in] listener callback listener
117 void CAUtilSetFoundDeviceListener(jobject listener);
124 #endif /* CA_UTILS_INTERFACE_H_ */