テスト用
Fork of nRF51822 by
nordic/nrf-sdk/ble/ble_sensorsim.h@69:936d81c963fe, 2014-09-26 (annotated)
- Committer:
- Rohit Grover
- Date:
- Fri Sep 26 14:46:19 2014 +0100
- Revision:
- 69:936d81c963fe
- Parent:
- 37:c29c330d942c
Release 0.2.1
=============
Features
~~~~~~~~
- Turn on the service-changed characteristic by default.
Bugfixes
~~~~~~~~
- Raised the maximum number of supported characteristics/descriptors to 24
(was 10 previously). We're beginning to find services like Device-
Information with several characteristics populated.
Compatibility
~~~~~~~~~~~~~
Works with 0.2.0 of BLE_API.
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 | /** @file |
bogdanm | 0:eff01767de02 | 14 | * |
bogdanm | 0:eff01767de02 | 15 | * @defgroup ble_sdk_lib_sensorsim Sensor Data Simulator |
bogdanm | 0:eff01767de02 | 16 | * @{ |
bogdanm | 0:eff01767de02 | 17 | * @ingroup ble_sdk_lib |
bogdanm | 0:eff01767de02 | 18 | * @brief Functions for simulating sensor data. |
bogdanm | 0:eff01767de02 | 19 | * |
bogdanm | 0:eff01767de02 | 20 | * @details Currently only a triangular waveform simulator is implemented. |
bogdanm | 0:eff01767de02 | 21 | */ |
bogdanm | 0:eff01767de02 | 22 | |
bogdanm | 0:eff01767de02 | 23 | #ifndef BLE_SENSORSIM_H__ |
bogdanm | 0:eff01767de02 | 24 | #define BLE_SENSORSIM_H__ |
bogdanm | 0:eff01767de02 | 25 | |
bogdanm | 0:eff01767de02 | 26 | #include <stdint.h> |
bogdanm | 0:eff01767de02 | 27 | #include <stdbool.h> |
bogdanm | 0:eff01767de02 | 28 | |
bogdanm | 0:eff01767de02 | 29 | /**@brief Triangular waveform sensor simulator configuration. */ |
bogdanm | 0:eff01767de02 | 30 | typedef struct |
bogdanm | 0:eff01767de02 | 31 | { |
bogdanm | 0:eff01767de02 | 32 | uint32_t min; /**< Minimum simulated value. */ |
bogdanm | 0:eff01767de02 | 33 | uint32_t max; /**< Maximum simulated value. */ |
bogdanm | 0:eff01767de02 | 34 | uint32_t incr; /**< Increment between each measurement. */ |
bogdanm | 0:eff01767de02 | 35 | bool start_at_max; /**< TRUE is measurement is to start at the maximum value, FALSE if it is to start at the minimum. */ |
bogdanm | 0:eff01767de02 | 36 | } ble_sensorsim_cfg_t; |
bogdanm | 0:eff01767de02 | 37 | |
bogdanm | 0:eff01767de02 | 38 | /**@brief Triangular waveform sensor simulator state. */ |
bogdanm | 0:eff01767de02 | 39 | typedef struct |
bogdanm | 0:eff01767de02 | 40 | { |
bogdanm | 0:eff01767de02 | 41 | uint32_t current_val; /**< Current sensor value. */ |
bogdanm | 0:eff01767de02 | 42 | bool is_increasing; /**< TRUE if the simulator is in increasing state, FALSE otherwise. */ |
bogdanm | 0:eff01767de02 | 43 | } ble_sensorsim_state_t; |
bogdanm | 0:eff01767de02 | 44 | |
bogdanm | 0:eff01767de02 | 45 | /**@brief Function for initializing a triangular waveform sensor simulator. |
bogdanm | 0:eff01767de02 | 46 | * |
bogdanm | 0:eff01767de02 | 47 | * @param[out] p_state Current state of simulator. |
bogdanm | 0:eff01767de02 | 48 | * @param[in] p_cfg Simulator configuration. |
bogdanm | 0:eff01767de02 | 49 | */ |
bogdanm | 0:eff01767de02 | 50 | void ble_sensorsim_init(ble_sensorsim_state_t * p_state, |
bogdanm | 0:eff01767de02 | 51 | const ble_sensorsim_cfg_t * p_cfg); |
bogdanm | 0:eff01767de02 | 52 | |
bogdanm | 0:eff01767de02 | 53 | /**@brief Function for generating a simulated sensor measurement using a triangular waveform generator. |
bogdanm | 0:eff01767de02 | 54 | * |
bogdanm | 0:eff01767de02 | 55 | * @param[in,out] p_state Current state of simulator. |
bogdanm | 0:eff01767de02 | 56 | * @param[in] p_cfg Simulator configuration. |
bogdanm | 0:eff01767de02 | 57 | * |
bogdanm | 0:eff01767de02 | 58 | * @return Simulator output. |
bogdanm | 0:eff01767de02 | 59 | */ |
bogdanm | 0:eff01767de02 | 60 | uint32_t ble_sensorsim_measure(ble_sensorsim_state_t * p_state, |
bogdanm | 0:eff01767de02 | 61 | const ble_sensorsim_cfg_t * p_cfg); |
bogdanm | 0:eff01767de02 | 62 | |
bogdanm | 0:eff01767de02 | 63 | #endif // BLE_SENSORSIM_H__ |
bogdanm | 0:eff01767de02 | 64 | |
bogdanm | 0:eff01767de02 | 65 | /** @} */ |