ir_helper.h (1344B)
1 #pragma once 2 3 #include <furi.h> 4 #include <infrared.h> 5 #include <lib/infrared/signal/infrared_signal.h> 6 7 /** 8 * IR signal container with name. 9 */ 10 typedef struct { 11 InfraredSignal *signal; 12 FuriString *name; 13 } IrSignalItem; 14 15 /** 16 * List of signals parsed from an .ir file. 17 */ 18 typedef struct { 19 IrSignalItem *items; 20 size_t count; 21 size_t capacity; 22 } IrSignalList; 23 24 /** 25 * Allocate an IR signal list. 26 */ 27 IrSignalList *ir_signal_list_alloc(void); 28 29 /** 30 * Free an IR signal list and all contained signals. 31 */ 32 void ir_signal_list_free(IrSignalList *list); 33 34 /** 35 * Load all signals from an .ir file. 36 * 37 * @param path File path to load 38 * @param list Output list of signals 39 * @return true on success 40 */ 41 bool ir_helper_load_file(const char *path, IrSignalList *list); 42 43 /** 44 * Transmit an IR signal. 45 * 46 * @param signal The signal to transmit 47 */ 48 void ir_helper_transmit(InfraredSignal *signal); 49 50 /** 51 * List .ir files in a directory. 52 * 53 * @param dir_path Directory path (e.g., "/ext/infrared") 54 * @param files Output: array of FuriString* (caller frees) 55 * @param count Output: number of files 56 * @return true on success 57 */ 58 bool ir_helper_list_files(const char *dir_path, FuriString ***files, 59 size_t *count); 60 61 /** 62 * Free a list of file paths. 63 */ 64 void ir_helper_free_file_list(FuriString **files, size_t count);