view_info.c 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. /* Copyright (C) 2022-2023 Salvatore Sanfilippo -- All Rights Reserved
  2. * See the LICENSE file for information about the license. */
  3. #include "app.h"
  4. /* Renders the view with the detected message information. */
  5. void render_view_info(Canvas *const canvas, ProtoViewApp *app) {
  6. if (app->signal_decoded == false) {
  7. canvas_set_font(canvas, FontSecondary);
  8. canvas_draw_str(canvas, 30,36,"No signal decoded");
  9. return;
  10. }
  11. /* Protocol name as title. */
  12. canvas_set_font(canvas, FontPrimary);
  13. uint8_t y = 8, lineheight = 10;
  14. canvas_draw_str(canvas, 0, y, app->signal_info.name);
  15. y += lineheight;
  16. /* Info fields. */
  17. char buf[128];
  18. canvas_set_font(canvas, FontSecondary);
  19. if (app->signal_info.raw[0]) {
  20. snprintf(buf,sizeof(buf),"Raw: %s", app->signal_info.raw);
  21. canvas_draw_str(canvas, 0, y, buf);
  22. y += lineheight;
  23. }
  24. canvas_draw_str(canvas, 0, y, app->signal_info.info1);
  25. y += lineheight;
  26. canvas_draw_str(canvas, 0, y, app->signal_info.info2);
  27. y += lineheight;
  28. canvas_draw_str(canvas, 0, y, app->signal_info.info3);
  29. y += lineheight;
  30. }
  31. /* Handle input for the settings view. */
  32. void process_input_info(ProtoViewApp *app, InputEvent input) {
  33. UNUSED(app);
  34. UNUSED(input);
  35. return;
  36. }