diff --git a/applications/subghz/scenes/subghz_scene_set_seed.c b/applications/subghz/scenes/subghz_scene_set_seed.c index fee2f2307..5d9516e73 100644 --- a/applications/subghz/scenes/subghz_scene_set_seed.c +++ b/applications/subghz/scenes/subghz_scene_set_seed.c @@ -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, ""); diff --git a/lib/subghz/protocols/faac_slh.c b/lib/subghz/protocols/faac_slh.c index 96dcc32ec..4937b8eb4 100644 --- a/lib/subghz/protocols/faac_slh.c +++ b/lib/subghz/protocols/faac_slh.c @@ -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 diff --git a/lib/subghz/protocols/faac_slh.h b/lib/subghz/protocols/faac_slh.h index 288892191..0cb2790ef 100644 --- a/lib/subghz/protocols/faac_slh.h +++ b/lib/subghz/protocols/faac_slh.h @@ -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