mirror of
https://github.com/DarkFlippers/unleashed-firmware
synced 2024-11-23 04:53:08 +00:00
3164184bbc
* SubGhz: protocols library refactoring * SubGhz: new architecture and refactoring * SubGhz: simplify protocol structure, remove unused types * SubGhz: rename Subghz to SubGhz * SubGhz: add environment concept Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com> Co-authored-by: DrZlo13 <who.just.the.doctor@gmail.com>
67 lines
1.8 KiB
C
67 lines
1.8 KiB
C
#include "environment.h"
|
|
|
|
struct SubGhzEnvironment {
|
|
SubGhzKeystore* keystore;
|
|
const char* came_atomo_rainbow_table_file_name;
|
|
const char* nice_flor_s_rainbow_table_file_name;
|
|
};
|
|
|
|
SubGhzEnvironment* subghz_environment_alloc() {
|
|
SubGhzEnvironment* instance = malloc(sizeof(SubGhzEnvironment));
|
|
|
|
instance->keystore = subghz_keystore_alloc();
|
|
instance->came_atomo_rainbow_table_file_name = NULL;
|
|
instance->nice_flor_s_rainbow_table_file_name = NULL;
|
|
|
|
return instance;
|
|
}
|
|
|
|
void subghz_environment_free(SubGhzEnvironment* instance) {
|
|
furi_assert(instance);
|
|
|
|
subghz_keystore_free(instance->keystore);
|
|
|
|
free(instance);
|
|
}
|
|
|
|
bool subghz_environment_load_keystore(SubGhzEnvironment* instance, const char* filename) {
|
|
furi_assert(instance);
|
|
|
|
return subghz_keystore_load(instance->keystore, filename);
|
|
}
|
|
|
|
SubGhzKeystore* subghz_environment_get_keystore(SubGhzEnvironment* instance) {
|
|
furi_assert(instance);
|
|
|
|
return instance->keystore;
|
|
}
|
|
|
|
void subghz_environment_set_came_atomo_rainbow_table_file_name(
|
|
SubGhzEnvironment* instance,
|
|
const char* filename) {
|
|
furi_assert(instance);
|
|
|
|
instance->came_atomo_rainbow_table_file_name = filename;
|
|
}
|
|
|
|
const char*
|
|
subghz_environment_get_came_atomo_rainbow_table_file_name(SubGhzEnvironment* instance) {
|
|
furi_assert(instance);
|
|
|
|
return instance->came_atomo_rainbow_table_file_name;
|
|
}
|
|
|
|
void subghz_environment_set_nice_flor_s_rainbow_table_file_name(
|
|
SubGhzEnvironment* instance,
|
|
const char* filename) {
|
|
furi_assert(instance);
|
|
|
|
instance->nice_flor_s_rainbow_table_file_name = filename;
|
|
}
|
|
|
|
const char*
|
|
subghz_environment_get_nice_flor_s_rainbow_table_file_name(SubGhzEnvironment* instance) {
|
|
furi_assert(instance);
|
|
|
|
return instance->nice_flor_s_rainbow_table_file_name;
|
|
}
|