Cascoda SDK
Cascoda SDK for building software to run with CA-821x transceivers
cascoda_settings.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2016, The OpenThread Authors.
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions are met:
7  * 1. Redistributions of source code must retain the above copyright
8  * notice, this list of conditions and the following disclaimer.
9  * 2. Redistributions in binary form must reproduce the above copyright
10  * notice, this list of conditions and the following disclaimer in the
11  * documentation and/or other materials provided with the distribution.
12  * 3. Neither the name of the copyright holder nor the
13  * names of its contributors may be used to endorse or promote products
14  * derived from this software without specific prior written permission.
15  *
16  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
20  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26  * POSSIBILITY OF SUCH DAMAGE.
27  */
28 
35 #ifndef CASCODA_SETTINGS_H
36 #define CASCODA_SETTINGS_H
37 
38 #include "ca821x_api.h"
39 
40 #ifdef __cplusplus
41 extern "C" {
42 #endif
43 
56 {
57  const uint8_t *value;
58  uint16_t length;
59 };
60 
87 void caUtilSettingsInit(struct ca821x_dev *aInstance, const char *aApplicationName, uint32_t aNodeId);
88 
95 void caUtilSettingsDeinit(struct ca821x_dev *aInstance);
96 
128 ca_error caUtilSettingsGet(struct ca821x_dev *aInstance,
129  uint16_t aKey,
130  int aIndex,
131  uint8_t *aValue,
132  uint16_t *aValueLength);
133 
155 ca_error caUtilSettingsSet(struct ca821x_dev *aInstance, uint16_t aKey, const uint8_t *aValue, uint16_t aValueLength);
156 
182 ca_error caUtilSettingsAdd(struct ca821x_dev *aInstance, uint16_t aKey, const uint8_t *aValue, uint16_t aValueLength);
183 
202 ca_error caUtilSettingsDelete(struct ca821x_dev *aInstance, uint16_t aKey, int aIndex);
203 
215 void caUtilSettingsWipe(struct ca821x_dev *aInstance, const char *aApplicationName, uint32_t aNodeId);
216 
231  uint16_t aKey,
232  int aIndex,
233  void **aValue,
234  uint16_t *aValueLength);
235 
249  uint16_t aKey,
250  struct settingBuffer *aVector,
251  size_t aCount);
252 
258 #ifdef __cplusplus
259 } // extern "C"
260 #endif
261 
262 #endif // CASCODA_SETTINGS_H
The main ca821x-api include file.
ca_error
Cascoda error type.
Definition: ca821x_error.h:51
void caUtilSettingsWipe(struct ca821x_dev *aInstance, const char *aApplicationName, uint32_t aNodeId)
Removes all settings from the setting store.
Definition: cascoda_settings.c:632
void caUtilSettingsInit(struct ca821x_dev *aInstance, const char *aApplicationName, uint32_t aNodeId)
Performs any initialization for the settings subsystem, if necessary.
Definition: cascoda_settings.c:372
void caUtilSettingsDeinit(struct ca821x_dev *aInstance)
Performs any de-initialization for the settings subsystem, if necessary.
Definition: cascoda_settings.c:447
ca_error caUtilSettingsAddVector(struct ca821x_dev *aInstance, uint16_t aKey, struct settingBuffer *aVector, size_t aCount)
Add a vector of buffers to the storage.
Definition: cascoda_settings.c:569
ca_error caUtilSettingsGet(struct ca821x_dev *aInstance, uint16_t aKey, int aIndex, uint8_t *aValue, uint16_t *aValueLength)
This function fetches the value of the setting identified by aKey and write it to the memory pointed ...
Definition: cascoda_settings.c:493
ca_error caUtilSettingsSet(struct ca821x_dev *aInstance, uint16_t aKey, const uint8_t *aValue, uint16_t aValueLength)
Sets or replaces the value of a setting.
Definition: cascoda_settings.c:549
ca_error caUtilSettingsDelete(struct ca821x_dev *aInstance, uint16_t aKey, int aIndex)
Removes a setting from the setting store.
Definition: cascoda_settings.c:581
ca_error caUtilSettingsAdd(struct ca821x_dev *aInstance, uint16_t aKey, const uint8_t *aValue, uint16_t aValueLength)
Adds a value to a setting This function adds the value to a setting identified by aKey,...
Definition: cascoda_settings.c:556
ca_error caUtilSettingsGetAddress(struct ca821x_dev *aInstance, uint16_t aKey, int aIndex, void **aValue, uint16_t *aValueLength)
Get the address at which a particular setting is stored.
Definition: cascoda_settings.c:528
CA-821x Device reference struct.
Definition: ca821x_api.h:123
Data structure for vectored I/O using caUtilSettingsAddVector.
Definition: cascoda_settings.h:56
const uint8_t * value
Pointer to the data to write to settings.
Definition: cascoda_settings.h:57
uint16_t length
Length of the data to write to settings.
Definition: cascoda_settings.h:58