iOSのBLEコントローラアプリ「RCBController」と接続し、コントローラの操作を取得するサンプルプログラムです。 mbed HRM1017で動作を確認しています。 2014.08.20時点でのBLEライブラリに対応しました。
Fork of BLE_RCBController by
HRM1017/nordic/ble/ble_services/ble_srv_common.cpp@4:ebda47d22091, 2014-08-20 (annotated)
- Committer:
- jksoft
- Date:
- Wed Aug 20 13:41:01 2014 +0000
- Revision:
- 4:ebda47d22091
- Parent:
- nRF51822/nordic/ble/ble_services/ble_srv_common.cpp@1:48f6e08a3ac2
?????????
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
jksoft | 0:8c643bfe55b7 | 1 | /* Copyright (c) 2012 Nordic Semiconductor. All Rights Reserved. |
jksoft | 0:8c643bfe55b7 | 2 | * |
jksoft | 0:8c643bfe55b7 | 3 | * The information contained herein is property of Nordic Semiconductor ASA. |
jksoft | 0:8c643bfe55b7 | 4 | * Terms and conditions of usage are described in detail in NORDIC |
jksoft | 0:8c643bfe55b7 | 5 | * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT. |
jksoft | 0:8c643bfe55b7 | 6 | * |
jksoft | 0:8c643bfe55b7 | 7 | * Licensees are granted free, non-transferable use of the information. NO |
jksoft | 0:8c643bfe55b7 | 8 | * WARRANTY of ANY KIND is provided. This heading must NOT be removed from |
jksoft | 0:8c643bfe55b7 | 9 | * the file. |
jksoft | 0:8c643bfe55b7 | 10 | * |
jksoft | 0:8c643bfe55b7 | 11 | */ |
jksoft | 0:8c643bfe55b7 | 12 | |
jksoft | 0:8c643bfe55b7 | 13 | /* Attention! |
jksoft | 0:8c643bfe55b7 | 14 | * To maintain compliance with Nordic Semiconductor ASAs Bluetooth profile |
jksoft | 0:8c643bfe55b7 | 15 | * qualification listings, this section of source code must not be modified. |
jksoft | 0:8c643bfe55b7 | 16 | */ |
jksoft | 0:8c643bfe55b7 | 17 | |
jksoft | 0:8c643bfe55b7 | 18 | #include "ble_srv_common.h" |
jksoft | 0:8c643bfe55b7 | 19 | #include <string.h> |
jksoft | 0:8c643bfe55b7 | 20 | #include "nordic_common.h" |
jksoft | 0:8c643bfe55b7 | 21 | #include "app_error.h" |
jksoft | 0:8c643bfe55b7 | 22 | |
jksoft | 0:8c643bfe55b7 | 23 | |
jksoft | 0:8c643bfe55b7 | 24 | uint8_t ble_srv_report_ref_encode(uint8_t * p_encoded_buffer, |
jksoft | 0:8c643bfe55b7 | 25 | const ble_srv_report_ref_t * p_report_ref) |
jksoft | 0:8c643bfe55b7 | 26 | { |
jksoft | 0:8c643bfe55b7 | 27 | uint8_t len = 0; |
jksoft | 0:8c643bfe55b7 | 28 | |
jksoft | 0:8c643bfe55b7 | 29 | p_encoded_buffer[len++] = p_report_ref->report_id; |
jksoft | 0:8c643bfe55b7 | 30 | p_encoded_buffer[len++] = p_report_ref->report_type; |
jksoft | 0:8c643bfe55b7 | 31 | |
jksoft | 0:8c643bfe55b7 | 32 | APP_ERROR_CHECK_BOOL(len == BLE_SRV_ENCODED_REPORT_REF_LEN); |
jksoft | 0:8c643bfe55b7 | 33 | return len; |
jksoft | 0:8c643bfe55b7 | 34 | } |
jksoft | 0:8c643bfe55b7 | 35 | |
jksoft | 0:8c643bfe55b7 | 36 | |
jksoft | 0:8c643bfe55b7 | 37 | void ble_srv_ascii_to_utf8(ble_srv_utf8_str_t * p_utf8, char * p_ascii) |
jksoft | 0:8c643bfe55b7 | 38 | { |
jksoft | 0:8c643bfe55b7 | 39 | p_utf8->length = (uint16_t)strlen(p_ascii); |
jksoft | 0:8c643bfe55b7 | 40 | p_utf8->p_str = (uint8_t *)p_ascii; |
jksoft | 0:8c643bfe55b7 | 41 | } |