1 /******************************************************************
3 * Copyright 2014 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 ******************************************************************/
23 * @brief This file contains the APIs for Wi-Fi communications.
25 #ifndef __CA_LECORE_H_
26 #define __CA_LECORE_H_
29 #include "uthreadpool.h"
36 typedef void (*CAPacketReceiveCallback)(const char* address, const char* data);
38 void CALEInitialize(u_thread_pool_t handle);
42 int32_t CALESendUnicastMessage(const char* address, const char* data, int32_t length);
44 int32_t CALESendMulticastMessage(const char* m_address, const char* data);
46 int32_t CALEStartUnicastServer(const char* address, int32_t port);
48 int32_t CALEStartMulticastServer(const char* m_address, int32_t port);
50 int32_t CALEStopUnicastServer(int32_t server_id);
52 int32_t CALEStopMulticastServer(int32_t server_id);
54 void CALESetCallback(CAPacketReceiveCallback callback);
56 void CAGetLocalAddress(char* addressBuffer);
58 int32_t CASendUnicastMessageImpl(const char* address, const char* data);
60 int32_t CASendMulticastMessageImpl(const char* msg);
63 * BT Common Method : JNI
65 jstring CANativeGetLocalDeviceAddress(JNIEnv* env);
67 jobjectArray CANativeGetBondedDevices(JNIEnv *env);
69 jint CANativeGetBTStateOnInfo(JNIEnv *env);
71 jstring CANativeGetRemoteAddress(JNIEnv *env, jobject bluetoothSocketObj);
73 void CANativeGattClose(JNIEnv *env, jobject bluetoothGatt);
75 void CANativeLEStartScan(JNIEnv *env, jobject callback);
77 void CANativeLEScanService(JNIEnv *env, jobjectArray uuids, jobject callback);
79 void CANativeLEStopScan(JNIEnv *env, jobject callback);
81 void CANativeLEConnect(JNIEnv *env, jstring address, jobject context, jboolean autoConnect, jobject callback);
83 void CANativeLEDisconnect(JNIEnv *env, jobject bluetoothGatt);
85 void CANativeLEDiscoverServices(JNIEnv *env, jobject bluetoothGatt);
87 void CANativeLESendData(JNIEnv *env, jobject bluetoothGatt, jobject gattCharacteristic);