irda-app-scene-learn.cpp 926 B

12345678910111213141516171819202122232425262728293031
  1. #include "../irda-app.hpp"
  2. void IrdaAppSceneLearn::on_enter(IrdaApp* app) {
  3. auto view_manager = app->get_view_manager();
  4. auto receiver = app->get_receiver();
  5. auto event_queue = view_manager->get_event_queue();
  6. receiver->capture_once_start(event_queue);
  7. auto popup = view_manager->get_popup();
  8. popup_set_icon(popup, 0, 32, I_IrdaLearnShort_128x31);
  9. popup_set_text(
  10. popup, "Point the remote at IR port\nand push the button", 5, 10, AlignLeft, AlignCenter);
  11. popup_set_callback(popup, NULL);
  12. view_manager->switch_to(IrdaAppViewManager::ViewType::Popup);
  13. }
  14. bool IrdaAppSceneLearn::on_event(IrdaApp* app, IrdaAppEvent* event) {
  15. bool consumed = false;
  16. if(event->type == IrdaAppEvent::Type::IrdaMessageReceived) {
  17. app->switch_to_next_scene_without_saving(IrdaApp::Scene::LearnSuccess);
  18. }
  19. return consumed;
  20. }
  21. void IrdaAppSceneLearn::on_exit(IrdaApp* app) {
  22. }