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 * This file contains the APIs for BT EDR communications.
25 #ifndef CA_EDR_SERVER_H_
26 #define CA_EDR_SERVER_H_
31 #include "cathreadpool.h"
39 typedef void (*CAPacketReceiveCallback)(const char *address, const char *data);
42 * Initialize JNI object.
44 void CAEDRServerJniInit();
47 * Start Accept Thread.
48 * @return ::CA_STATUS_OK or Appropriate error code.
50 CAResult_t CAEDRServerStartAcceptThread();
53 * Start receive thread.
54 * @param[in] isSecured unicast server type.
55 * @return ::CA_STATUS_OK or Appropriate error code.
57 CAResult_t CAEDRStartReceiveThread(bool isSecured);
60 * Stop receive thread.
61 * @return ::CA_STATUS_OK or Appropriate error code.
63 CAResult_t CAEDRStopReceiveThread();
66 * This function will read the data from remote device.
67 * @param[in] env JNI interface pointer.
68 * @param[in] id index of remote address.
69 * @return ::CA_STATUS_OK or Appropriate error code.
71 CAResult_t CAEDRNativeReadData(JNIEnv *env, uint32_t id);
75 * @param[in] env JNI interface pointer.
77 void CANativeStartListenTask(JNIEnv *env);
80 * This function will listen the connection from remote device.
81 * @param[in] env JNI interface pointer.
82 * @return server socket object or NULL.
84 jobject CAEDRNativeListen(JNIEnv *env);
87 * This function will accept the connection from remote device.
88 * @param[in] env JNI interface pointer.
89 * @param[in] severSocketObject server socket object.
91 void CAEDRNativeAccept(JNIEnv *env, jobject severSocketObject);
94 * Remove all device objects in the list.
95 * @param[in] env JNI interface pointer.
97 void CAEDRNatvieCloseServerTask(JNIEnv* env);
103 #endif /* CA_EDR_SERVER_H_ */