 c8180747db
			
		
	
	
		c8180747db
		
			
		
	
	
	
	
		
			
			* Do not load all signals at once (Draft) * Minor cleanup * Refactor remote renaming * Improve function signatures * Rename infrared_remote functions * Optimise signal loading * Implement adding signals to remote * Add read_name() method * Deprecate a function * Partially implement deleting signals (draft) * Use m-array instead of m-list for signal name directory * Use plain C strings instead of furi_string * Implement deleting signals * Implement deleting signals via generalised callback * Implement renaming signals * Rename some types * Some more renaming * Remove unused type * Implement inserting signals (internal use) * Improve InfraredMoveView * Send an event to move a signal * Remove unused type * Implement moving signals * Implement creating new remotes with one signal * Un-deprecate and rename a function * Add InfraredRemote API docs * Add InfraredSignal API docs * Better error messages * Show progress pop-up when moving buttons in a remote * Copy labels to the InfraredMoveView to avoid pointer invalidation * Improve file selection scene * Show progress pop-up when renaming buttons in a remote * Refactor a scene * Show progress when deleting a button from remote * Use a random name for temp files * Add docs to infrared_brute_force.h * Rename Infrared type to InfraredApp * Add docs to infrared_app_i.h Co-authored-by: あく <alleteam@gmail.com>
		
			
				
	
	
		
			48 lines
		
	
	
		
			1.8 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
			
		
		
	
	
			48 lines
		
	
	
		
			1.8 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
| #include "../infrared_app_i.h"
 | |
| #include <dolphin/dolphin.h>
 | |
| 
 | |
| void infrared_scene_learn_on_enter(void* context) {
 | |
|     InfraredApp* infrared = context;
 | |
|     Popup* popup = infrared->popup;
 | |
|     InfraredWorker* worker = infrared->worker;
 | |
| 
 | |
|     infrared_worker_rx_set_received_signal_callback(
 | |
|         worker, infrared_signal_received_callback, context);
 | |
|     infrared_worker_rx_start(worker);
 | |
|     infrared_play_notification_message(infrared, InfraredNotificationMessageBlinkStartRead);
 | |
| 
 | |
|     popup_set_icon(popup, 0, 32, &I_InfraredLearnShort_128x31);
 | |
|     popup_set_header(popup, NULL, 0, 0, AlignCenter, AlignCenter);
 | |
|     popup_set_text(
 | |
|         popup, "Point the remote at IR port\nand push the button", 5, 10, AlignLeft, AlignCenter);
 | |
|     popup_set_callback(popup, NULL);
 | |
| 
 | |
|     view_dispatcher_switch_to_view(infrared->view_dispatcher, InfraredViewPopup);
 | |
| }
 | |
| 
 | |
| bool infrared_scene_learn_on_event(void* context, SceneManagerEvent event) {
 | |
|     InfraredApp* infrared = context;
 | |
|     bool consumed = false;
 | |
| 
 | |
|     if(event.type == SceneManagerEventTypeCustom) {
 | |
|         if(event.event == InfraredCustomEventTypeSignalReceived) {
 | |
|             infrared_play_notification_message(infrared, InfraredNotificationMessageSuccess);
 | |
|             scene_manager_next_scene(infrared->scene_manager, InfraredSceneLearnSuccess);
 | |
|             dolphin_deed(DolphinDeedIrLearnSuccess);
 | |
|             consumed = true;
 | |
|         }
 | |
|     }
 | |
| 
 | |
|     return consumed;
 | |
| }
 | |
| 
 | |
| void infrared_scene_learn_on_exit(void* context) {
 | |
|     InfraredApp* infrared = context;
 | |
|     Popup* popup = infrared->popup;
 | |
|     infrared_worker_rx_set_received_signal_callback(infrared->worker, NULL, NULL);
 | |
|     infrared_worker_rx_stop(infrared->worker);
 | |
|     infrared_play_notification_message(infrared, InfraredNotificationMessageBlinkStop);
 | |
|     popup_set_icon(popup, 0, 0, NULL);
 | |
|     popup_set_text(popup, NULL, 0, 0, AlignCenter, AlignCenter);
 | |
| }
 |