added
Dependencies: mbed microbit BLE_API nRF51822
ConfigParamsPersistence.h@11:6916c05fde52, 2018-09-07 (annotated)
- Committer:
- suntopbd
- Date:
- Fri Sep 07 20:17:07 2018 +0000
- Revision:
- 11:6916c05fde52
Microbit BLE UART IoT
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
suntopbd | 11:6916c05fde52 | 1 | /* mbed Microcontroller Library |
suntopbd | 11:6916c05fde52 | 2 | * Copyright (c) 2006-2015 ARM Limited |
suntopbd | 11:6916c05fde52 | 3 | * |
suntopbd | 11:6916c05fde52 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
suntopbd | 11:6916c05fde52 | 5 | * you may not use this file except in compliance with the License. |
suntopbd | 11:6916c05fde52 | 6 | * You may obtain a copy of the License at |
suntopbd | 11:6916c05fde52 | 7 | * |
suntopbd | 11:6916c05fde52 | 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
suntopbd | 11:6916c05fde52 | 9 | * |
suntopbd | 11:6916c05fde52 | 10 | * Unless required by applicable law or agreed to in writing, software |
suntopbd | 11:6916c05fde52 | 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
suntopbd | 11:6916c05fde52 | 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
suntopbd | 11:6916c05fde52 | 13 | * See the License for the specific language governing permissions and |
suntopbd | 11:6916c05fde52 | 14 | * limitations under the License. |
suntopbd | 11:6916c05fde52 | 15 | */ |
suntopbd | 11:6916c05fde52 | 16 | |
suntopbd | 11:6916c05fde52 | 17 | #ifndef __BLE_CONFIG_PARAMS_PERSISTENCE_H__ |
suntopbd | 11:6916c05fde52 | 18 | #define __BLE_CONFIG_PARAMS_PERSISTENCE_H__ |
suntopbd | 11:6916c05fde52 | 19 | |
suntopbd | 11:6916c05fde52 | 20 | #include "ble/services/URIBeaconConfigService.h" |
suntopbd | 11:6916c05fde52 | 21 | |
suntopbd | 11:6916c05fde52 | 22 | /** |
suntopbd | 11:6916c05fde52 | 23 | * Generic API to load the URIBeacon configuration parameters from persistent |
suntopbd | 11:6916c05fde52 | 24 | * storage. If persistent storage isn't available, the persistenceSignature |
suntopbd | 11:6916c05fde52 | 25 | * member of params may be left un-initialized to the MAGIC, and this will cause |
suntopbd | 11:6916c05fde52 | 26 | * a reset to default values. |
suntopbd | 11:6916c05fde52 | 27 | * |
suntopbd | 11:6916c05fde52 | 28 | * @param[out] paramsP |
suntopbd | 11:6916c05fde52 | 29 | * The parameters to be filled in from persistence storage. This |
suntopbd | 11:6916c05fde52 | 30 | argument can be NULL if the caller is only interested in |
suntopbd | 11:6916c05fde52 | 31 | discovering the persistence status of params. |
suntopbd | 11:6916c05fde52 | 32 | |
suntopbd | 11:6916c05fde52 | 33 | * @return true if params were loaded from persistent storage and have usefully |
suntopbd | 11:6916c05fde52 | 34 | * initialized fields. |
suntopbd | 11:6916c05fde52 | 35 | */ |
suntopbd | 11:6916c05fde52 | 36 | bool loadURIBeaconConfigParams(URIBeaconConfigService::Params_t *paramsP); |
suntopbd | 11:6916c05fde52 | 37 | |
suntopbd | 11:6916c05fde52 | 38 | /** |
suntopbd | 11:6916c05fde52 | 39 | * Generic API to store the URIBeacon configuration parameters to persistent |
suntopbd | 11:6916c05fde52 | 40 | * storage. It typically initializes the persistenceSignature member of the |
suntopbd | 11:6916c05fde52 | 41 | * params to the MAGIC value to indicate persistence. |
suntopbd | 11:6916c05fde52 | 42 | * |
suntopbd | 11:6916c05fde52 | 43 | * @note: the save operation may be asynchronous. It may be a short while before |
suntopbd | 11:6916c05fde52 | 44 | * the request takes affect. Reading back saved configParams may not yield |
suntopbd | 11:6916c05fde52 | 45 | * correct behaviour if attempted soon after a store. |
suntopbd | 11:6916c05fde52 | 46 | * |
suntopbd | 11:6916c05fde52 | 47 | * @param[in/out] paramsP |
suntopbd | 11:6916c05fde52 | 48 | * The params to be saved; persistenceSignature member gets |
suntopbd | 11:6916c05fde52 | 49 | * updated if persistence is successful. |
suntopbd | 11:6916c05fde52 | 50 | */ |
suntopbd | 11:6916c05fde52 | 51 | void saveURIBeaconConfigParams(const URIBeaconConfigService::Params_t *paramsP); |
suntopbd | 11:6916c05fde52 | 52 | |
suntopbd | 11:6916c05fde52 | 53 | #endif /* #ifndef __BLE_CONFIG_PARAMS_PERSISTENCE_H__*/ |