nochanges
Dependents: BLE_Acceleration_Statejudging
Fork of nRF51822 by
nordic/ble/ble_services/ble_srv_common.cpp@0:eff01767de02, 2014-03-26 (annotated)
- Committer:
- bogdanm
- Date:
- Wed Mar 26 14:38:17 2014 +0000
- Revision:
- 0:eff01767de02
- Child:
- 65:98215c4f3a25
Initial import of the nRF51822 code
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
bogdanm | 0:eff01767de02 | 1 | /* Copyright (c) 2012 Nordic Semiconductor. All Rights Reserved. |
bogdanm | 0:eff01767de02 | 2 | * |
bogdanm | 0:eff01767de02 | 3 | * The information contained herein is property of Nordic Semiconductor ASA. |
bogdanm | 0:eff01767de02 | 4 | * Terms and conditions of usage are described in detail in NORDIC |
bogdanm | 0:eff01767de02 | 5 | * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT. |
bogdanm | 0:eff01767de02 | 6 | * |
bogdanm | 0:eff01767de02 | 7 | * Licensees are granted free, non-transferable use of the information. NO |
bogdanm | 0:eff01767de02 | 8 | * WARRANTY of ANY KIND is provided. This heading must NOT be removed from |
bogdanm | 0:eff01767de02 | 9 | * the file. |
bogdanm | 0:eff01767de02 | 10 | * |
bogdanm | 0:eff01767de02 | 11 | */ |
bogdanm | 0:eff01767de02 | 12 | |
bogdanm | 0:eff01767de02 | 13 | /* Attention! |
bogdanm | 0:eff01767de02 | 14 | * To maintain compliance with Nordic Semiconductor ASAs Bluetooth profile |
bogdanm | 0:eff01767de02 | 15 | * qualification listings, this section of source code must not be modified. |
bogdanm | 0:eff01767de02 | 16 | */ |
bogdanm | 0:eff01767de02 | 17 | |
bogdanm | 0:eff01767de02 | 18 | #include "ble_srv_common.h" |
bogdanm | 0:eff01767de02 | 19 | #include <string.h> |
bogdanm | 0:eff01767de02 | 20 | #include "nordic_common.h" |
bogdanm | 0:eff01767de02 | 21 | #include "app_error.h" |
bogdanm | 0:eff01767de02 | 22 | |
bogdanm | 0:eff01767de02 | 23 | |
bogdanm | 0:eff01767de02 | 24 | uint8_t ble_srv_report_ref_encode(uint8_t * p_encoded_buffer, |
bogdanm | 0:eff01767de02 | 25 | const ble_srv_report_ref_t * p_report_ref) |
bogdanm | 0:eff01767de02 | 26 | { |
bogdanm | 0:eff01767de02 | 27 | uint8_t len = 0; |
bogdanm | 0:eff01767de02 | 28 | |
bogdanm | 0:eff01767de02 | 29 | p_encoded_buffer[len++] = p_report_ref->report_id; |
bogdanm | 0:eff01767de02 | 30 | p_encoded_buffer[len++] = p_report_ref->report_type; |
bogdanm | 0:eff01767de02 | 31 | |
bogdanm | 0:eff01767de02 | 32 | APP_ERROR_CHECK_BOOL(len == BLE_SRV_ENCODED_REPORT_REF_LEN); |
bogdanm | 0:eff01767de02 | 33 | return len; |
bogdanm | 0:eff01767de02 | 34 | } |
bogdanm | 0:eff01767de02 | 35 | |
bogdanm | 0:eff01767de02 | 36 | |
bogdanm | 0:eff01767de02 | 37 | void ble_srv_ascii_to_utf8(ble_srv_utf8_str_t * p_utf8, char * p_ascii) |
bogdanm | 0:eff01767de02 | 38 | { |
bogdanm | 0:eff01767de02 | 39 | p_utf8->length = (uint16_t)strlen(p_ascii); |
bogdanm | 0:eff01767de02 | 40 | p_utf8->p_str = (uint8_t *)p_ascii; |
bogdanm | 0:eff01767de02 | 41 | } |