Mayank Gupta / Mbed OS pelion-example-frdm

Dependencies:   FXAS21002 FXOS8700Q

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers arm-pal-kv.h Source File

arm-pal-kv.h

00001 // ----------------------------------------------------------------------------
00002 // Copyright 2016-2017 ARM Ltd.
00003 //
00004 // SPDX-License-Identifier: Apache-2.0
00005 //
00006 // Licensed under the Apache License, Version 2.0 (the "License");
00007 // you may not use this file except in compliance with the License.
00008 // You may obtain a copy of the License at
00009 //
00010 //     http://www.apache.org/licenses/LICENSE-2.0
00011 //
00012 // Unless required by applicable law or agreed to in writing, software
00013 // distributed under the License is distributed on an "AS IS" BASIS,
00014 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00015 // See the License for the specific language governing permissions and
00016 // limitations under the License.
00017 // ----------------------------------------------------------------------------
00018 
00019 #ifndef ARM_PAL_KV_H
00020 #define ARM_PAL_KV_H
00021 
00022 #include <stdint.h>
00023 #include <stddef.h>
00024 
00025 #ifdef __cplusplus
00026 extern "C" {
00027 #endif
00028 
00029 
00030 #define ARM_PAL_KV_KEY_MAX_PATH 220
00031 
00032 typedef struct arm_pal_key_value_api {
00033     uint32_t (*keySize)();
00034     void (*keyInit)(void *key);
00035 
00036     int32_t (*Close)(void *hkey);
00037     int32_t (*Create)(const char *key_name, size_t value_len, const void *kdesc, void *hkey);
00038     int32_t (*Delete)(void *hkey);
00039     int32_t (*Find)(const char *key_name_query, const void *previous, void *next);
00040     int32_t (*Flush)(void);
00041     int32_t (*GetKeyName)(void *hkey, char *key_name, uint8_t *key_len);
00042     int32_t (*GetValueLen)(void *hkey, size_t *value_len);
00043     int32_t (*Initialize)(
00044         void(*callback)(int32_t status, int32_t cmd_code, void *client_context, void *handle),
00045         void *client_context);
00046     int32_t (*PowerControl)(uint32_t state);
00047     int32_t (*Read)(void *hkey, void *data, size_t *len);
00048     int32_t (*Open)(const char *key_name, uint32_t flags, void *hkey);
00049     int32_t (*Rseek)(void *hkey, size_t offset);
00050     int32_t (*Uninitialize)(void);
00051     int32_t (*Write)(void *hkey, const char *data, size_t *len);
00052 } arm_pal_key_value_api;
00053 
00054 
00055 #define ARM_PAL_KV_OPENMODE_RD (1 << 3)
00056 
00057 uint32_t ARM_PAL_KV_keySize(const arm_pal_key_value_api *api);
00058 void ARM_PAL_KV_keyInit(const arm_pal_key_value_api *api, void *key);
00059 int32_t ARM_PAL_KV_Close(const arm_pal_key_value_api *api, void *hkey);
00060 int32_t ARM_PAL_KV_Create(const arm_pal_key_value_api *api, const char *key_name, size_t value_len, const void *kdesc,
00061                           void *hkey);
00062 int32_t ARM_PAL_KV_Delete(const arm_pal_key_value_api *api, void *hkey);
00063 int32_t ARM_PAL_KV_Find(const arm_pal_key_value_api *api, const char *key_name_query, const void *previous, void *next);
00064 int32_t ARM_PAL_KV_Flush(const arm_pal_key_value_api *api);
00065 int32_t ARM_PAL_KV_GetKeyName(const arm_pal_key_value_api *api, void *hkey, char *key_name, uint8_t *key_len);
00066 int32_t ARM_PAL_KV_GetValueLen(const arm_pal_key_value_api *api, void *hkey, size_t *value_len);
00067 int32_t ARM_PAL_KV_Initialize(const arm_pal_key_value_api *api, void(*callback)(int32_t status, int32_t cmd_code,
00068                                                                                 void *client_context, void *handle), void *client_context);
00069 int32_t ARM_PAL_KV_PowerControl(const arm_pal_key_value_api *api, uint32_t state);
00070 int32_t ARM_PAL_KV_Read(const arm_pal_key_value_api *api, void *hkey, void *data, size_t *len);
00071 int32_t ARM_PAL_KV_Open(const arm_pal_key_value_api *api, const char *key_name, uint32_t flags, void *hkey);
00072 int32_t ARM_PAL_KV_Rseek(const arm_pal_key_value_api *api, void *hkey, size_t offset);
00073 int32_t ARM_PAL_KV_Uninitialize(const arm_pal_key_value_api *api);
00074 int32_t ARM_PAL_KV_Write(const arm_pal_key_value_api *api, void *hkey, const char *data, size_t *len);
00075 
00076 
00077 
00078 
00079 #ifdef __cplusplus
00080 }
00081 #endif
00082 
00083 
00084 #endif // ARM_PAL_KV_H