seed transfer to decoder

This commit is contained in:
r3df0xx 2022-04-27 17:01:07 +03:00
parent 8b984b363d
commit 77a1a58d67
3 changed files with 20 additions and 4 deletions

View File

@ -53,12 +53,15 @@ bool subghz_scene_set_seed_on_event(void* context, SceneManagerEvent event) {
"FAAC_SLH",
868350000,
FuriHalSubGhzPresetOok650Async);
subghz_protocol_faac_slh_set_seed_to_decoder(subghz->txrx->transmitter->protocol_instance, seed);
uint8_t seed_data[sizeof(uint32_t)] = {0};
for(size_t i = 0; i < sizeof(uint32_t); i++) {
seed_data[sizeof(uint32_t) - i - 1] = (seed >> i * 8) & 0xFF;
}
flipper_format_write_hex(subghz->txrx->fff_data, "Seed", seed_data, sizeof(uint32_t));
FURI_LOG_I(TAG, "SEED (set_seed_on_event): %8X\n", seed);
FURI_LOG_I(TAG, "SEED: %8X\n", seed);
generated_protocol = true;
} else {
generated_protocol = false;
@ -85,9 +88,6 @@ bool subghz_scene_set_seed_on_event(void* context, SceneManagerEvent event) {
void subghz_scene_set_seed_on_exit(void* context) {
SubGhz* subghz = context;
uint32_t seed = subghz->txrx->secure_data->seed[0] << 24 | subghz->txrx->secure_data->seed[1] << 16 |
subghz->txrx->secure_data->seed[2] << 8 | subghz->txrx->secure_data->seed[3];
FURI_LOG_I(TAG, "SEED (set_seed_on_exit): %8X\n", seed);
// Clear view
byte_input_set_result_callback(subghz->byte_input, NULL, NULL, NULL, NULL, 0);
byte_input_set_header_text(subghz->byte_input, "");

View File

@ -393,6 +393,15 @@ void subghz_protocol_decoder_faac_slh_feed(void* context, bool level, uint32_t d
}
}
void subghz_protocol_faac_slh_set_seed_to_decoder(void* context, uint32_t seed) {
furi_assert(context);
SubGhzProtocolDecoderFaacSLH* instance = context;
instance->generic.seed = seed;
subghz_protocol_faac_slh_check_remote_controller(
&instance->generic, instance->keystore, &instance->manufacture_name);
FURI_LOG_I(TAG, "SEED (to_decoder): %8X\n", instance->generic.seed);
}
/**
* Analysis of received data
* @param instance Pointer to a SubGhzBlockGeneric* instance

View File

@ -48,6 +48,13 @@ bool subghz_protocol_faac_slh_create_data(
uint32_t frequency,
FuriHalSubGhzPreset preset);
/**
* Transfering seed value from Encoder to Decoder
* @param context - Pointer to a SubGhzProtocolDecoderFaacSLH instance
* @param seed Seed value, 32 bit
*/
void subghz_protocol_faac_slh_set_seed_to_decoder(void* context, uint32_t seed);
/**
* Deserialize and generating an upload to send.
* @param context Pointer to a SubGhzProtocolEncoderFaacSLH instance