mirror of
https://github.com/DarkFlippers/unleashed-firmware.git
synced 2024-12-26 23:05:05 +03: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>
82 lines
2.2 KiB
C
82 lines
2.2 KiB
C
#pragma once
|
|
|
|
#include <stdint.h>
|
|
#include <stdbool.h>
|
|
#include <furi.h>
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
/** Extract int value and trim arguments string
|
|
*
|
|
* @param args - arguments string
|
|
* @param word first argument, output
|
|
* @return true - success
|
|
* @return false - arguments string does not contain int
|
|
*/
|
|
bool args_read_int_and_trim(FuriString* args, int* value);
|
|
|
|
/**
|
|
* @brief Extract first argument from arguments string and trim arguments string
|
|
*
|
|
* @param args arguments string
|
|
* @param word first argument, output
|
|
* @return true - success
|
|
* @return false - arguments string does not contain anything
|
|
*/
|
|
bool args_read_string_and_trim(FuriString* args, FuriString* word);
|
|
|
|
/**
|
|
* @brief Extract the first quoted argument from the argument string and trim the argument string. If the argument is not quoted, calls args_read_string_and_trim.
|
|
*
|
|
* @param args arguments string
|
|
* @param word first argument, output, without quotes
|
|
* @return true - success
|
|
* @return false - arguments string does not contain anything
|
|
*/
|
|
bool args_read_probably_quoted_string_and_trim(FuriString* args, FuriString* word);
|
|
|
|
/**
|
|
* @brief Convert hex ASCII values to byte array
|
|
*
|
|
* @param args arguments string
|
|
* @param bytes byte array pointer, output
|
|
* @param bytes_count needed bytes count
|
|
* @return true - success
|
|
* @return false - arguments string does not contain enough values, or contain non-hex ASCII values
|
|
*/
|
|
bool args_read_hex_bytes(FuriString* args, uint8_t* bytes, size_t bytes_count);
|
|
|
|
/************************************ HELPERS ***************************************/
|
|
|
|
/**
|
|
* @brief Get length of first word from arguments string
|
|
*
|
|
* @param args arguments string
|
|
* @return size_t length of first word
|
|
*/
|
|
size_t args_get_first_word_length(FuriString* args);
|
|
|
|
/**
|
|
* @brief Get length of arguments string
|
|
*
|
|
* @param args arguments string
|
|
* @return size_t length of arguments string
|
|
*/
|
|
size_t args_length(FuriString* args);
|
|
|
|
/**
|
|
* @brief Convert ASCII hex values to byte
|
|
*
|
|
* @param hi_nibble ASCII hi nibble character
|
|
* @param low_nibble ASCII low nibble character
|
|
* @param byte byte pointer, output
|
|
* @return bool conversion status
|
|
*/
|
|
bool args_char_to_hex(char hi_nibble, char low_nibble, uint8_t* byte);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|