Implementation of connectivity abstraction feature Release v0.3
[platform/upstream/iotivity.git] / resource / csdk / connectivity / inc / calecore.h
1 /******************************************************************
2  *
3  * Copyright 2014 Samsung Electronics All Rights Reserved.
4  *
5  *
6  *
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
10  *
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  *
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.
18  *
19  ******************************************************************/
20
21 /**
22  * @file cawificore.h
23  * @brief This file contains the APIs for Wi-Fi communications.
24  */
25 #ifndef __CA_LECORE_H_
26 #define __CA_LECORE_H_
27
28 #include "cacommon.h"
29 #include "uthreadpool.h"
30
31 #ifdef __cplusplus
32 extern "C"
33 {
34 #endif
35
36 typedef void (*CAPacketReceiveCallback)(const char* address, const char* data);
37
38 void CALEInitialize(u_thread_pool_t handle);
39
40 void CALETerminate();
41
42 int32_t CALESendUnicastMessage(const char* address, const char* data, int32_t length);
43
44 int32_t CALESendMulticastMessage(const char* m_address, const char* data);
45
46 int32_t CALEStartUnicastServer(const char* address, int32_t port);
47
48 int32_t CALEStartMulticastServer(const char* m_address, int32_t port);
49
50 int32_t CALEStopUnicastServer(int32_t server_id);
51
52 int32_t CALEStopMulticastServer(int32_t server_id);
53
54 void CALESetCallback(CAPacketReceiveCallback callback);
55
56 void CAGetLocalAddress(char* addressBuffer);
57
58 int32_t CASendUnicastMessageImpl(const char* address, const char* data);
59
60 int32_t CASendMulticastMessageImpl(const char* msg);
61
62 /**
63  * BT Common Method : JNI
64  */
65 jstring CANativeGetLocalDeviceAddress(JNIEnv* env);
66
67 jobjectArray CANativeGetBondedDevices(JNIEnv *env);
68
69 jint CANativeGetBTStateOnInfo(JNIEnv *env);
70
71 jstring CANativeGetRemoteAddress(JNIEnv *env, jobject bluetoothSocketObj);
72
73 void CANativeGattClose(JNIEnv *env, jobject bluetoothGatt);
74
75 void CANativeLEStartScan(JNIEnv *env, jobject callback);
76
77 void CANativeLEScanService(JNIEnv *env, jobjectArray uuids, jobject callback);
78
79 void CANativeLEStopScan(JNIEnv *env, jobject callback);
80
81 void CANativeLEConnect(JNIEnv *env, jstring address, jobject context, jboolean autoConnect, jobject callback);
82
83 void CANativeLEDisconnect(JNIEnv *env, jobject bluetoothGatt);
84
85 void CANativeLEDiscoverServices(JNIEnv *env, jobject bluetoothGatt);
86
87 void CANativeLESendData(JNIEnv *env, jobject bluetoothGatt, jobject gattCharacteristic);
88 #ifdef __cplusplus
89 } /* extern "C" */
90 #endif
91
92 #endif