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 unsigned char CAIsBleDataAvailable()
64 return ble_available();
67 unsigned char CAIsBleConnected()
69 return ble_connected();
73 return (char)ble_read();
76 CAResult_t CABleDoEvents()
82 CAResult_t CAUpdateCharacteristicsToAllGattClients(const char *char_value,
85 // ble_write_bytes() api can send only max of 255 bytes at a time
86 // This function shall never be called to send more than 255 bytes by the fragmentation logic.
87 // Currently ble_write_bytes api returns void.
88 ble_write_bytes((unsigned char *)char_value, (unsigned char)valueLength);