Commit 3b93225c authored by bg.chun's avatar bg.chun Committed by Ashok Babu Channa

[tizen]Modify bt_edr adapter to apply new logger

Modify tizen bt_edr apdapter to apply new logger
which is Analyzer.

Change-Id: I49d57a1d633c1d899494567080763f4ebdb26ccb
Signed-off-by: default avatarbg.chun <bg.chun@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/14961Tested-by: default avatarjenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: default avatarDan Mihai <Daniel.Mihai@microsoft.com>
Reviewed-by: default avatarJaehong Jo <jaehong.jo@samsung.com>
Reviewed-by: default avatarAshok Babu Channa <ashok.channa@samsung.com>
parent 512d5a42
......@@ -211,8 +211,8 @@ void CAEDRSocketConnectionStateCallback(int result, bt_socket_connection_state_e
while (device->pendingDataList)
{
EDRData *edrData = device->pendingDataList->data;
res = CAEDRSendData(device->socketFD, edrData->data,
edrData->dataLength);
res = CAEDRSendData(device->socketFD, device->remoteAddress,
edrData->data, edrData->dataLength);
if (CA_STATUS_OK != res)
{
OIC_LOG_V(ERROR, EDR_ADAPTER_TAG, "Failed to send pending data [%s]",
......@@ -753,7 +753,7 @@ CAResult_t CAEDRClientSendUnicastData(const char *remoteAddress,
}
else
{
result = CAEDRSendData(device->socketFD, data, dataLength);
result = CAEDRSendData(device->socketFD, device->remoteAddress, data, dataLength);
if (CA_STATUS_OK != result)
{
OIC_LOG(ERROR, EDR_ADAPTER_TAG, "Failed to send data!");
......@@ -826,7 +826,7 @@ CAResult_t CAEDRClientSendMulticastData(const uint8_t *data,
}
else
{
result = CAEDRSendData(device->socketFD, data, dataLength);
result = CAEDRSendData(device->socketFD, device->remoteAddress ,data, dataLength);
if (CA_STATUS_OK != result)
{
OIC_LOG_V(ERROR, EDR_ADAPTER_TAG, "Failed to send data to [%s] !",
......
......@@ -29,11 +29,12 @@
#include "caedrutils.h"
#include "logger.h"
CAResult_t CAEDRSendData(int serverFD, const void *data, uint32_t dataLength)
CAResult_t CAEDRSendData(int serverFD, const char *addr, const void *data, uint32_t dataLength)
{
OIC_LOG(DEBUG, EDR_ADAPTER_TAG, "IN");
VERIFY_NON_NULL(data, EDR_ADAPTER_TAG, "Data is null");
VERIFY_NON_NULL(addr, EDR_ADAPTER_TAG, "Addr is null");
if (0 > serverFD)
{
......@@ -42,14 +43,28 @@ CAResult_t CAEDRSendData(int serverFD, const void *data, uint32_t dataLength)
}
int dataLen = bt_socket_send_data(serverFD, (const char *)data, dataLength);
if (dataLen == -1)
int errcode = get_last_result();
if (TIZEN_ERROR_NONE == errcode)
{
OIC_LOG_V(ERROR, EDR_ADAPTER_TAG, "sending data failed!, soketid [%d]", serverFD);
return CA_SOCKET_OPERATION_FAILED;
CALogSendStateInfo(CA_ADAPTER_RFCOMM_BTEDR, addr, 0, dataLength, true, NULL);
}
else if (dataLen == 0)
else
{
OIC_LOG_V(ERROR, EDR_ADAPTER_TAG, "soketid [%d] may be disconnected?", serverFD);
if (dataLen == -1)
{
OIC_LOG_V(ERROR, EDR_ADAPTER_TAG, "sending data failed!, soketid [%d] errmsg [%s]",
serverFD, get_error_message(errcode));
}
else if (dataLen == 0)
{
OIC_LOG_V(ERROR, EDR_ADAPTER_TAG, "soketid [%d] may be disconnected? errmsg [%s]",
serverFD, get_error_message(errcode));
}
CALogSendStateInfo(CA_ADAPTER_RFCOMM_BTEDR, addr, 0, dataLength,
false, get_error_message(errcode));
return CA_SOCKET_OPERATION_FAILED;
}
......
......@@ -28,7 +28,7 @@
#define CA_EDR_ENDPOINT_H_
#include <bluetooth.h>
#include <tizen.h>
#include "cacommon.h"
#ifdef __cplusplus
......@@ -48,7 +48,7 @@ extern "C"
* @retval ::CA_STATUS_INVALID_PARAM Invalid input arguments.
* @retval ::CA_STATUS_FAILED Operation failed.
*/
CAResult_t CAEDRSendData(int serverFD, const void *data, uint32_t dataLength);
CAResult_t CAEDRSendData(int serverFD, const char *addr, const void *data, uint32_t dataLength);
#ifdef __cplusplus
} /* extern "C" */
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment