mirror of
https://github.com/DarkFlippers/unleashed-firmware
synced 2024-12-18 00:33:09 +00:00
4bf29827f8
* Quicksave 1 * Header stage complete * Source stage complete * Lint & merge fixes * Includes * Documentation step 1 * FBT: output free size considering BT STACK * Documentation step 2 * py lint * Fix music player plugin * unit test stage 1: string allocator, mem, getters, setters, appends, compare, search. * unit test: string equality * unit test: string replace * unit test: string start_with, end_with * unit test: string trim * unit test: utf-8 * Rename * Revert fw_size changes * Simplify CLI backspace handling * Simplify CLI character insert * Merge fixes * Furi: correct filenaming and spelling * Bt: remove furi string include Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
95 lines
1.9 KiB
C
95 lines
1.9 KiB
C
#pragma once
|
|
#include <stdlib.h>
|
|
#include <stdbool.h>
|
|
#include <toolbox/stream/stream.h>
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
typedef enum {
|
|
FlipperStreamValueIgnore,
|
|
FlipperStreamValueStr,
|
|
FlipperStreamValueHex,
|
|
FlipperStreamValueFloat,
|
|
FlipperStreamValueInt32,
|
|
FlipperStreamValueUint32,
|
|
FlipperStreamValueHexUint64,
|
|
FlipperStreamValueBool,
|
|
} FlipperStreamValue;
|
|
|
|
typedef struct {
|
|
const char* key;
|
|
FlipperStreamValue type;
|
|
const void* data;
|
|
size_t data_size;
|
|
} FlipperStreamWriteData;
|
|
|
|
/**
|
|
* Writes a key/value pair to the stream.
|
|
* @param stream
|
|
* @param write_data
|
|
* @return true
|
|
* @return false
|
|
*/
|
|
bool flipper_format_stream_write_value_line(Stream* stream, FlipperStreamWriteData* write_data);
|
|
|
|
/**
|
|
* Reads a value by key from a stream.
|
|
* @param stream
|
|
* @param key
|
|
* @param type
|
|
* @param _data
|
|
* @param data_size
|
|
* @param strict_mode
|
|
* @return true
|
|
* @return false
|
|
*/
|
|
bool flipper_format_stream_read_value_line(
|
|
Stream* stream,
|
|
const char* key,
|
|
FlipperStreamValue type,
|
|
void* _data,
|
|
size_t data_size,
|
|
bool strict_mode);
|
|
|
|
/**
|
|
* Get the count of values by key from a stream.
|
|
* @param stream
|
|
* @param key
|
|
* @param count
|
|
* @param strict_mode
|
|
* @return true
|
|
* @return false
|
|
*/
|
|
bool flipper_format_stream_get_value_count(
|
|
Stream* stream,
|
|
const char* key,
|
|
uint32_t* count,
|
|
bool strict_mode);
|
|
|
|
/**
|
|
* Removes a key and the corresponding value string from the stream and inserts a new key/value pair.
|
|
* @param stream
|
|
* @param write_data
|
|
* @param strict_mode
|
|
* @return true
|
|
* @return false
|
|
*/
|
|
bool flipper_format_stream_delete_key_and_write(
|
|
Stream* stream,
|
|
FlipperStreamWriteData* write_data,
|
|
bool strict_mode);
|
|
|
|
/**
|
|
* Writes a comment string to the stream.
|
|
* @param stream
|
|
* @param data
|
|
* @return true
|
|
* @return false
|
|
*/
|
|
bool flipper_format_stream_write_comment_cstr(Stream* stream, const char* data);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|