byte_input.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. /**
  2. * @file byte_input.h
  3. * GUI: ByteInput keyboard view module API
  4. */
  5. #pragma once
  6. #include <gui/view.h>
  7. #ifdef __cplusplus
  8. extern "C" {
  9. #endif
  10. /** Byte input anonymous structure */
  11. typedef struct ByteInput ByteInput;
  12. /** callback that is executed on save button press */
  13. typedef void (*ByteInputCallback)(void* context);
  14. /** callback that is executed when byte buffer is changed */
  15. typedef void (*ByteChangedCallback)(void* context);
  16. /** Allocate and initialize byte input. This byte input is used to enter bytes.
  17. *
  18. * @return ByteInput instance pointer
  19. */
  20. ByteInput* byte_input_alloc();
  21. /** Deinitialize and free byte input
  22. *
  23. * @param byte_input Byte input instance
  24. */
  25. void byte_input_free(ByteInput* byte_input);
  26. /** Get byte input view
  27. *
  28. * @param byte_input byte input instance
  29. *
  30. * @return View instance that can be used for embedding
  31. */
  32. View* byte_input_get_view(ByteInput* byte_input);
  33. /** Set byte input result callback
  34. *
  35. * @param byte_input byte input instance
  36. * @param input_callback input callback fn
  37. * @param changed_callback changed callback fn
  38. * @param callback_context callback context
  39. * @param bytes buffer to use
  40. * @param bytes_count buffer length
  41. */
  42. void byte_input_set_result_callback(
  43. ByteInput* byte_input,
  44. ByteInputCallback input_callback,
  45. ByteChangedCallback changed_callback,
  46. void* callback_context,
  47. uint8_t* bytes,
  48. uint8_t bytes_count);
  49. /** Set byte input header text
  50. *
  51. * @param byte_input byte input instance
  52. * @param text text to be shown
  53. */
  54. void byte_input_set_header_text(ByteInput* byte_input, const char* text);
  55. #ifdef __cplusplus
  56. }
  57. #endif