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 ******************************************************************/
22 * @file caedrendpoint.c
23 * @brief This file provides the APIs to send data on established RFCOMM connections.
26 #include "caedrendpoint.h"
27 #include "caadapterutils.h"
28 #include "caedrutils.h"
31 CAResult_t CAEDRSendData(int serverFD, const void *data, uint32_t dataLength,
32 uint32_t *sentDataLen)
34 OIC_LOG_V(DEBUG, EDR_ADAPTER_TAG, "IN");
36 VERIFY_NON_NULL(data, EDR_ADAPTER_TAG, "Data is null");
37 VERIFY_NON_NULL(sentDataLen, EDR_ADAPTER_TAG, "Sent data length holder is null");
41 OIC_LOG_V(ERROR, EDR_ADAPTER_TAG, "Invalid input: Negative socket id");
42 return CA_STATUS_INVALID_PARAM;
45 int dataLen = bt_socket_send_data(serverFD, (const char *)data, dataLength);
48 OIC_LOG_V(ERROR, EDR_ADAPTER_TAG, "sending data failed!, soketid [%d]", serverFD);
50 return CA_STATUS_FAILED;
53 *sentDataLen = dataLen;
54 OIC_LOG_V(DEBUG, EDR_ADAPTER_TAG, "OUT");