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 * @return ::CA_STATUS_OK or Appropriate error code.
55 CAResult_t CAEDRInitialize();
58 * Terminate server for EDR.
60 void CAEDRTerminate();
63 * destroy interface object and terminate the interface.
64 * @return ::CA_STATUS_OK or ERROR CODES (::CAResult_t error codes in cacommon.h).
66 CAResult_t CAEDRDestroyJniInterface();
69 * Initialize JNI object.
71 void CAEDRCoreJniInit();
74 * Send data for unicast.
75 * @param[in] address remote address.
76 * @param[in] data data for transmission.
77 * @param[in] dataLen data length.
78 * @return ::CA_STATUS_OK or Appropriate error code.
79 * @retval ::CA_STATUS_OK Successful.
80 * @retval ::CA_STATUS_FAILED Operation failed.
82 CAResult_t CAEDRSendUnicastMessage(const char *address, const uint8_t *data, uint32_t dataLen);
85 * Send data for multicast.
86 * @param[in] data data for transmission.
87 * @param[in] dataLen data length.
88 * @return ::CA_STATUS_OK or Appropriate error code.
89 * @retval ::CA_STATUS_OK Successful.
90 * @retval ::CA_STATUS_FAILED Operation failed.
92 CAResult_t CAEDRSendMulticastMessage(const uint8_t *data, uint32_t dataLen);
95 * Get Local EDR Address.
96 * @param[out] address local address.
97 * @return ::CA_STATUS_OK or Appropriate error code.
98 * @retval ::CA_STATUS_OK Successful.
99 * @retval ::CA_STATUS_FAILED Operation failed.
101 CAResult_t CAEDRGetInterfaceInfo(char **address);
104 * Get address from a local device.
105 * @param[out] address local address.
107 void CAEDRGetLocalAddress(char **address);
110 * Send data for unicast (implement).
111 * @param[in] address remote address.
112 * @param[in] data data for transmission.
113 * @param[in] dataLen data length.
114 * @return ::CA_STATUS_OK or Appropriate error code.
115 * @retval ::CA_STATUS_OK Successful.
116 * @retval ::CA_STATUS_FAILED Operation failed.
118 CAResult_t CAEDRSendUnicastMessageImpl(const char *address, const uint8_t *data, uint32_t dataLen);
121 * Send data for multicast (implement).
122 * @param[in] env JNI interface pointer.
123 * @param[in] data data for transmission.
124 * @param[in] dataLen data length.
125 * @return ::CA_STATUS_OK or Appropriate error code.
126 * @retval ::CA_STATUS_OK Successful.
127 * @retval ::CA_STATUS_FAILED Operation failed.
129 CAResult_t CAEDRSendMulticastMessageImpl(JNIEnv *env, const uint8_t *data, uint32_t dataLen);
136 * This function will send the data to remote device.
137 * @param[in] env JNI interface pointer.
138 * @param[in] address Remote Address.
139 * @param[in] data Data to be transmitted from EDR.
140 * @param[in] dataLength Length of data.
141 * @return ::CA_STATUS_OK or Appropriate error code.
143 CAResult_t CAEDRNativeSendData(JNIEnv *env, const char* address, const uint8_t* data,
144 uint32_t dataLength);
147 * This function will connect to remote device.
148 * @param[in] env JNI interface pointer.
149 * @param[in] address Remote Address.
150 * @return ::CA_STATUS_OK or Appropriate error code.
152 CAResult_t CAEDRNativeConnect(JNIEnv *env, const char *address);
155 * This function will close socket.
156 * @param[in] env JNI interface pointer.
157 * @param[in] address Remote Address.
159 void CAEDRNativeSocketClose(JNIEnv *env, const char *address);
165 #endif /* CA_EDR_CLIENT_H_ */