[FL-3331] SubGhz: add subghz_protocol_registry external API (#2712)
* [FL-3331] SubGhz: add subghz_protocol_registry external API * F18: fix API version --------- Co-authored-by: hedger <hedger@nanode.su>
This commit is contained in:
		
							parent
							
								
									3e1f209d64
								
							
						
					
					
						commit
						dbd48a04d4
					
				| @ -1,5 +1,5 @@ | |||||||
| entry,status,name,type,params | entry,status,name,type,params | ||||||
| Version,+,28.4,, | Version,+,29.0,, | ||||||
| Header,+,applications/services/bt/bt_service/bt.h,, | Header,+,applications/services/bt/bt_service/bt.h,, | ||||||
| Header,+,applications/services/cli/cli.h,, | Header,+,applications/services/cli/cli.h,, | ||||||
| Header,+,applications/services/cli/cli_vcp.h,, | Header,+,applications/services/cli/cli_vcp.h,, | ||||||
|  | |||||||
| 
 | 
| @ -1,5 +1,5 @@ | |||||||
| entry,status,name,type,params | entry,status,name,type,params | ||||||
| Version,+,28.4,, | Version,+,29.0,, | ||||||
| Header,+,applications/services/bt/bt_service/bt.h,, | Header,+,applications/services/bt/bt_service/bt.h,, | ||||||
| Header,+,applications/services/cli/cli.h,, | Header,+,applications/services/cli/cli.h,, | ||||||
| Header,+,applications/services/cli/cli_vcp.h,, | Header,+,applications/services/cli/cli_vcp.h,, | ||||||
| @ -189,6 +189,7 @@ Header,+,lib/subghz/environment.h,, | |||||||
| Header,+,lib/subghz/protocols/raw.h,, | Header,+,lib/subghz/protocols/raw.h,, | ||||||
| Header,+,lib/subghz/receiver.h,, | Header,+,lib/subghz/receiver.h,, | ||||||
| Header,+,lib/subghz/registry.h,, | Header,+,lib/subghz/registry.h,, | ||||||
|  | Header,+,lib/subghz/subghz_protocol_registry.h,, | ||||||
| Header,+,lib/subghz/subghz_setting.h,, | Header,+,lib/subghz/subghz_setting.h,, | ||||||
| Header,+,lib/subghz/subghz_tx_rx_worker.h,, | Header,+,lib/subghz/subghz_tx_rx_worker.h,, | ||||||
| Header,+,lib/subghz/subghz_worker.h,, | Header,+,lib/subghz/subghz_worker.h,, | ||||||
| @ -2662,12 +2663,12 @@ Function,+,subghz_environment_get_came_atomo_rainbow_table_file_name,const char* | |||||||
| Function,+,subghz_environment_get_keystore,SubGhzKeystore*,SubGhzEnvironment* | Function,+,subghz_environment_get_keystore,SubGhzKeystore*,SubGhzEnvironment* | ||||||
| Function,+,subghz_environment_get_nice_flor_s_rainbow_table_file_name,const char*,SubGhzEnvironment* | Function,+,subghz_environment_get_nice_flor_s_rainbow_table_file_name,const char*,SubGhzEnvironment* | ||||||
| Function,+,subghz_environment_get_protocol_name_registry,const char*,"SubGhzEnvironment*, size_t" | Function,+,subghz_environment_get_protocol_name_registry,const char*,"SubGhzEnvironment*, size_t" | ||||||
| Function,+,subghz_environment_get_protocol_registry,void*,SubGhzEnvironment* | Function,+,subghz_environment_get_protocol_registry,const SubGhzProtocolRegistry*,SubGhzEnvironment* | ||||||
| Function,+,subghz_environment_load_keystore,_Bool,"SubGhzEnvironment*, const char*" | Function,+,subghz_environment_load_keystore,_Bool,"SubGhzEnvironment*, const char*" | ||||||
| Function,+,subghz_environment_set_alutech_at_4n_rainbow_table_file_name,void,"SubGhzEnvironment*, const char*" | Function,+,subghz_environment_set_alutech_at_4n_rainbow_table_file_name,void,"SubGhzEnvironment*, const char*" | ||||||
| Function,+,subghz_environment_set_came_atomo_rainbow_table_file_name,void,"SubGhzEnvironment*, const char*" | Function,+,subghz_environment_set_came_atomo_rainbow_table_file_name,void,"SubGhzEnvironment*, const char*" | ||||||
| Function,+,subghz_environment_set_nice_flor_s_rainbow_table_file_name,void,"SubGhzEnvironment*, const char*" | Function,+,subghz_environment_set_nice_flor_s_rainbow_table_file_name,void,"SubGhzEnvironment*, const char*" | ||||||
| Function,+,subghz_environment_set_protocol_registry,void,"SubGhzEnvironment*, void*" | Function,+,subghz_environment_set_protocol_registry,void,"SubGhzEnvironment*, const SubGhzProtocolRegistry*" | ||||||
| Function,-,subghz_keystore_alloc,SubGhzKeystore*, | Function,-,subghz_keystore_alloc,SubGhzKeystore*, | ||||||
| Function,-,subghz_keystore_free,void,SubGhzKeystore* | Function,-,subghz_keystore_free,void,SubGhzKeystore* | ||||||
| Function,-,subghz_keystore_get_data,SubGhzKeyArray_t*,SubGhzKeystore* | Function,-,subghz_keystore_get_data,SubGhzKeyArray_t*,SubGhzKeystore* | ||||||
| @ -3361,6 +3362,7 @@ Variable,+,sequence_success,const NotificationSequence, | |||||||
| Variable,+,subghz_protocol_raw,const SubGhzProtocol, | Variable,+,subghz_protocol_raw,const SubGhzProtocol, | ||||||
| Variable,+,subghz_protocol_raw_decoder,const SubGhzProtocolDecoder, | Variable,+,subghz_protocol_raw_decoder,const SubGhzProtocolDecoder, | ||||||
| Variable,+,subghz_protocol_raw_encoder,const SubGhzProtocolEncoder, | Variable,+,subghz_protocol_raw_encoder,const SubGhzProtocolEncoder, | ||||||
|  | Variable,+,subghz_protocol_registry,const SubGhzProtocolRegistry, | ||||||
| Variable,-,suboptarg,char*, | Variable,-,suboptarg,char*, | ||||||
| Variable,+,usb_cdc_dual,FuriHalUsbInterface, | Variable,+,usb_cdc_dual,FuriHalUsbInterface, | ||||||
| Variable,+,usb_cdc_single,FuriHalUsbInterface, | Variable,+,usb_cdc_single,FuriHalUsbInterface, | ||||||
|  | |||||||
| 
 | 
| @ -18,6 +18,7 @@ env.Append( | |||||||
|         File("blocks/generic.h"), |         File("blocks/generic.h"), | ||||||
|         File("blocks/math.h"), |         File("blocks/math.h"), | ||||||
|         File("subghz_setting.h"), |         File("subghz_setting.h"), | ||||||
|  |         File("subghz_protocol_registry.h"), | ||||||
|     ], |     ], | ||||||
| ) | ) | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -92,16 +92,17 @@ const char* | |||||||
| 
 | 
 | ||||||
| void subghz_environment_set_protocol_registry( | void subghz_environment_set_protocol_registry( | ||||||
|     SubGhzEnvironment* instance, |     SubGhzEnvironment* instance, | ||||||
|     void* protocol_registry_items) { |     const SubGhzProtocolRegistry* protocol_registry_items) { | ||||||
|     furi_assert(instance); |     furi_assert(instance); | ||||||
|     const SubGhzProtocolRegistry* protocol_registry = protocol_registry_items; |     const SubGhzProtocolRegistry* protocol_registry = protocol_registry_items; | ||||||
|     instance->protocol_registry = protocol_registry; |     instance->protocol_registry = protocol_registry; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void* subghz_environment_get_protocol_registry(SubGhzEnvironment* instance) { | const SubGhzProtocolRegistry* | ||||||
|  |     subghz_environment_get_protocol_registry(SubGhzEnvironment* instance) { | ||||||
|     furi_assert(instance); |     furi_assert(instance); | ||||||
|     furi_assert(instance->protocol_registry); |     furi_assert(instance->protocol_registry); | ||||||
|     return (void*)instance->protocol_registry; |     return instance->protocol_registry; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| const char* | const char* | ||||||
|  | |||||||
| @ -1,6 +1,7 @@ | |||||||
| #pragma once | #pragma once | ||||||
| 
 | 
 | ||||||
| #include <furi.h> | #include <furi.h> | ||||||
|  | #include "registry.h" | ||||||
| 
 | 
 | ||||||
| #include "subghz_keystore.h" | #include "subghz_keystore.h" | ||||||
| 
 | 
 | ||||||
| @ -9,6 +10,7 @@ extern "C" { | |||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
| typedef struct SubGhzEnvironment SubGhzEnvironment; | typedef struct SubGhzEnvironment SubGhzEnvironment; | ||||||
|  | typedef struct SubGhzProtocolRegistry SubGhzProtocolRegistry; | ||||||
| 
 | 
 | ||||||
| /**
 | /**
 | ||||||
|  * Allocate SubGhzEnvironment. |  * Allocate SubGhzEnvironment. | ||||||
| @ -93,14 +95,15 @@ const char* | |||||||
|  */ |  */ | ||||||
| void subghz_environment_set_protocol_registry( | void subghz_environment_set_protocol_registry( | ||||||
|     SubGhzEnvironment* instance, |     SubGhzEnvironment* instance, | ||||||
|     void* protocol_registry_items); |     const SubGhzProtocolRegistry* protocol_registry_items); | ||||||
| 
 | 
 | ||||||
| /**
 | /**
 | ||||||
|  * Get list of protocols to work. |  * Get list of protocols to work. | ||||||
|  * @param instance Pointer to a SubGhzEnvironment instance |  * @param instance Pointer to a SubGhzEnvironment instance | ||||||
|  * @return Pointer to a SubGhzProtocolRegistry |  * @return Pointer to a SubGhzProtocolRegistry | ||||||
|  */ |  */ | ||||||
| void* subghz_environment_get_protocol_registry(SubGhzEnvironment* instance); | const SubGhzProtocolRegistry* | ||||||
|  |     subghz_environment_get_protocol_registry(SubGhzEnvironment* instance); | ||||||
| 
 | 
 | ||||||
| /**
 | /**
 | ||||||
|  * Get list of protocols names. |  * Get list of protocols names. | ||||||
|  | |||||||
| @ -1,5 +1,6 @@ | |||||||
| #pragma once | #pragma once | ||||||
| #include "../registry.h" | #include "../registry.h" | ||||||
|  | #include "../subghz_protocol_registry.h" | ||||||
| 
 | 
 | ||||||
| #include "princeton.h" | #include "princeton.h" | ||||||
| #include "keeloq.h" | #include "keeloq.h" | ||||||
| @ -43,5 +44,3 @@ | |||||||
| #include "alutech_at_4n.h" | #include "alutech_at_4n.h" | ||||||
| #include "kinggates_stylo_4k.h" | #include "kinggates_stylo_4k.h" | ||||||
| #include "bin_raw.h" | #include "bin_raw.h" | ||||||
| 
 |  | ||||||
| extern const SubGhzProtocolRegistry subghz_protocol_registry; |  | ||||||
|  | |||||||
| @ -9,6 +9,7 @@ extern "C" { | |||||||
| typedef struct SubGhzEnvironment SubGhzEnvironment; | typedef struct SubGhzEnvironment SubGhzEnvironment; | ||||||
| 
 | 
 | ||||||
| typedef struct SubGhzProtocolRegistry SubGhzProtocolRegistry; | typedef struct SubGhzProtocolRegistry SubGhzProtocolRegistry; | ||||||
|  | typedef struct SubGhzProtocol SubGhzProtocol; | ||||||
| 
 | 
 | ||||||
| struct SubGhzProtocolRegistry { | struct SubGhzProtocolRegistry { | ||||||
|     const SubGhzProtocol** items; |     const SubGhzProtocol** items; | ||||||
|  | |||||||
							
								
								
									
										13
									
								
								lib/subghz/subghz_protocol_registry.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										13
									
								
								lib/subghz/subghz_protocol_registry.h
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,13 @@ | |||||||
|  | #pragma once | ||||||
|  | 
 | ||||||
|  | #include "registry.h" | ||||||
|  | 
 | ||||||
|  | #ifdef __cplusplus | ||||||
|  | extern "C" { | ||||||
|  | #endif | ||||||
|  | 
 | ||||||
|  | extern const SubGhzProtocolRegistry subghz_protocol_registry; | ||||||
|  | 
 | ||||||
|  | #ifdef __cplusplus | ||||||
|  | } | ||||||
|  | #endif | ||||||
| @ -21,6 +21,9 @@ | |||||||
| #define SUBGHZ_RAW_FILE_VERSION 1 | #define SUBGHZ_RAW_FILE_VERSION 1 | ||||||
| #define SUBGHZ_RAW_FILE_TYPE "Flipper SubGhz RAW File" | #define SUBGHZ_RAW_FILE_TYPE "Flipper SubGhz RAW File" | ||||||
| 
 | 
 | ||||||
|  | typedef struct SubGhzProtocolRegistry SubGhzProtocolRegistry; | ||||||
|  | typedef struct SubGhzEnvironment SubGhzEnvironment; | ||||||
|  | 
 | ||||||
| // Radio Preset
 | // Radio Preset
 | ||||||
| typedef struct { | typedef struct { | ||||||
|     FuriString* name; |     FuriString* name; | ||||||
| @ -115,11 +118,11 @@ typedef enum { | |||||||
|     SubGhzProtocolFlag_BinRAW = (1 << 10), |     SubGhzProtocolFlag_BinRAW = (1 << 10), | ||||||
| } SubGhzProtocolFlag; | } SubGhzProtocolFlag; | ||||||
| 
 | 
 | ||||||
| typedef struct { | struct SubGhzProtocol { | ||||||
|     const char* name; |     const char* name; | ||||||
|     SubGhzProtocolType type; |     SubGhzProtocolType type; | ||||||
|     SubGhzProtocolFlag flag; |     SubGhzProtocolFlag flag; | ||||||
| 
 | 
 | ||||||
|     const SubGhzProtocolEncoder* encoder; |     const SubGhzProtocolEncoder* encoder; | ||||||
|     const SubGhzProtocolDecoder* decoder; |     const SubGhzProtocolDecoder* decoder; | ||||||
| } SubGhzProtocol; | }; | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Skorpionm
						Skorpionm