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 BT EDR communications.
25 #ifndef CA_EDR_CLIENT_H_
26 #define CA_EDR_CLIENT_H_
31 #include "cathreadpool.h"
40 * Initialize context of application.
42 void CAEDRJniInitContext();
46 * @param[in] context context of application.
47 * @return ::CA_STATUS_OK or Appropriate error code.
49 CAResult_t CAEDRCreateJNIInterfaceObject(jobject context);
52 * Initialize client for EDR.
53 * @param[in] handle thread pool handle object.
55 void CAEDRInitialize(ca_thread_pool_t handle);
58 * Terminate server for EDR.
60 void CAEDRTerminate();
63 * Initialize JNI object.
65 void CAEDRCoreJniInit();
68 * Send data for unicast.
69 * @param[in] address remote address.
70 * @param[in] data data for transmission.
71 * @param[in] dataLen data length.
72 * @return ::CA_STATUS_OK or Appropriate error code.
73 * @retval ::CA_STATUS_OK Successful.
74 * @retval ::CA_STATUS_FAILED Operation failed.
76 CAResult_t CAEDRSendUnicastMessage(const char *address, const uint8_t *data, uint32_t dataLen);
79 * Send data for multicast.
80 * @param[in] data data for transmission.
81 * @param[in] dataLen data length.
82 * @return ::CA_STATUS_OK or Appropriate error code.
83 * @retval ::CA_STATUS_OK Successful.
84 * @retval ::CA_STATUS_FAILED Operation failed.
86 CAResult_t CAEDRSendMulticastMessage(const uint8_t *data, uint32_t dataLen);
89 * Get Local EDR Address.
90 * @param[out] address local address.
91 * @return ::CA_STATUS_OK or Appropriate error code.
92 * @retval ::CA_STATUS_OK Successful.
93 * @retval ::CA_STATUS_FAILED Operation failed.
95 CAResult_t CAEDRGetInterfaceInfo(char **address);
98 * Get address from a local device.
99 * @param[out] address local address.
101 void CAEDRGetLocalAddress(char **address);
104 * Send data for unicast (implement).
105 * @param[in] address remote address.
106 * @param[in] data data for transmission.
107 * @param[in] dataLen data length.
108 * @return ::CA_STATUS_OK or Appropriate error code.
109 * @retval ::CA_STATUS_OK Successful.
110 * @retval ::CA_STATUS_FAILED Operation failed.
112 CAResult_t CAEDRSendUnicastMessageImpl(const char *address, const uint8_t *data, uint32_t dataLen);
115 * Send data for multicast (implement).
116 * @param[in] env JNI interface pointer.
117 * @param[in] data data for transmission.
118 * @param[in] dataLen data length.
119 * @return ::CA_STATUS_OK or Appropriate error code.
120 * @retval ::CA_STATUS_OK Successful.
121 * @retval ::CA_STATUS_FAILED Operation failed.
123 CAResult_t CAEDRSendMulticastMessageImpl(JNIEnv *env, const uint8_t *data, uint32_t dataLen);
130 * This function will send the data to remote device.
131 * @param[in] env JNI interface pointer.
132 * @param[in] address Remote Address.
133 * @param[in] data Data to be transmitted from EDR.
134 * @param[in] dataLength Length of data.
135 * @return ::CA_STATUS_OK or Appropriate error code.
137 CAResult_t CAEDRNativeSendData(JNIEnv *env, const char* address, const uint8_t* data,
138 uint32_t dataLength);
141 * This function will connect to remote device.
142 * @param[in] env JNI interface pointer.
143 * @param[in] address Remote Address.
144 * @return ::CA_STATUS_OK or Appropriate error code.
146 CAResult_t CAEDRNativeConnect(JNIEnv *env, const char *address);
149 * This function will close socket.
150 * @param[in] env JNI interface pointer.
151 * @param[in] address Remote Address.
153 void CAEDRNativeSocketClose(JNIEnv *env, const char *address);
159 #endif /* CA_EDR_CLIENT_H_ */