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 //logger.h included first to avoid conflict with RBL library PROGMEM attribute
25 #include "cableserver.h"
30 #include <RBL_nRF8001.h>
32 #include "caleinterface_singlethread.h"
33 #include "oic_malloc.h"
34 #include "caadapterutils.h"
38 CAResult_t CAInitializeBle()
40 OIC_LOG(DEBUG, TAG, "IN");
42 // Set your BLE Shield name here, max. length 10
43 ble_set_name(__OIC_DEVICE_NAME__);
45 OIC_LOG(DEBUG, TAG, "LEName Set");
49 OIC_LOG(DEBUG, TAG, "OUT");
53 CAResult_t CATerminateBle()
55 OIC_LOG(DEBUG, TAG, "IN");
57 OIC_LOG(DEBUG, TAG, "OUT");
62 CAResult_t CAAddNewBleServiceInGattServer(const char *service_uuid)
64 // Not Supported - Done at compile time
68 CAResult_t CARemoveBleServiceFromGattServer(const char *svc_path)
70 // Not Supported - Done at compile time
74 CAResult_t CARemoveAllBleServicesFromGattServer()
80 CAResult_t CARegisterBleServicewithGattServer(const char *svc_path)
82 // Not Supported - Done at compile time
86 CAResult_t CAAddNewCharacteristicsToGattServer(const char *svc_path,
87 const char *char_uuid,
88 const char *char_value,
92 // Not Supported - Done at compile time
96 CAResult_t CARemoveCharacteristicsFromGattServer(const char *char_path)
102 unsigned char CAIsBleDataAvailable()
104 return ble_available();
107 unsigned char CAIsBleConnected()
109 return ble_connected();
113 return (char)ble_read();
116 CAResult_t CABleDoEvents()
122 CAResult_t CAUpdateCharacteristicsInGattServer(const char *char_value,
123 const uint32_t value_length)
125 // Currently ble_write_bytes api returns void.
126 ble_write_bytes((unsigned char *)char_value, (unsigned char)value_length);