videohubctrl can be used to control Blackmagic Design Videohub SDI router device over the network.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

cmd.h 2.2KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. /*
  2. * === Commands processing ===
  3. *
  4. * Blackmagic Design Videohub control application
  5. * Copyright (C) 2014 Unix Solutions Ltd.
  6. * Written by Georgi Chorbadzhiyski
  7. *
  8. * Released under MIT license.
  9. * See LICENSE-MIT.txt for license terms.
  10. *
  11. */
  12. #ifndef CMD_H
  13. #define CMD_H
  14. #include <stdbool.h>
  15. #define NUM_COMMANDS 27
  16. enum vcmd {
  17. CMD_PROTOCOL_PREAMBLE,
  18. CMD_VIDEOHUB_DEVICE,
  19. CMD_CONFIGURATION,
  20. CMD_END_PRELUDE,
  21. CMD_INPUT_LABELS,
  22. CMD_OUTPUT_LABELS,
  23. CMD_VIDEO_OUTPUT_LOCKS,
  24. CMD_VIDEO_OUTPUT_ROUTING,
  25. CMD_VIDEO_INPUT_STATUS,
  26. CMD_VIDEO_OUTPUT_STATUS,
  27. CMD_MONITORING_OUTPUT_LABELS,
  28. CMD_MONITORING_OUTPUT_LOCKS,
  29. CMD_MONITORING_OUTPUT_ROUTING,
  30. CMD_SERIAL_PORT_LABELS,
  31. CMD_SERIAL_PORT_LOCKS,
  32. CMD_SERIAL_PORT_ROUTING,
  33. CMD_SERIAL_PORT_STATUS,
  34. CMD_SERIAL_PORT_DIRECTIONS,
  35. CMD_PROCESSING_UNIT_ROUTING,
  36. CMD_PROCESSING_UNIT_LOCKS,
  37. CMD_FRAME_LABELS,
  38. CMD_FRAME_BUFFER_ROUTING,
  39. CMD_FRAME_BUFFER_LOCKS,
  40. CMD_ALARM_STATUS,
  41. CMD_PING,
  42. CMD_ACK,
  43. CMD_NAK = (NUM_COMMANDS - 1),
  44. };
  45. enum cmd_flags {
  46. PARSE_NONE, /* The result if this command needs no parsing */
  47. PARSE_CUSTOM, /* Use custom parser for this command */
  48. PARSE_LABEL, /* Parse [port_num] [port_text] */
  49. PARSE_STATUS, /* Parse [port_num] [port_status] */
  50. PARSE_ROUTE, /* Parse [port_num] [dest_port] */
  51. PARSE_LOCK, /* Parse [port_num] [dest_slot] */
  52. PARSE_DIR, /* Parse [port_num] [port_direction] - for serial ports */
  53. };
  54. struct videohub_commands {
  55. enum vcmd cmd;
  56. enum cmd_flags type;
  57. size_t ports1;
  58. size_t ports2;
  59. const char *port_id1;
  60. const char *port_id2;
  61. const char *opt_prefix;
  62. bool allow_disconnect;
  63. };
  64. extern struct videohub_commands videohub_commands[NUM_COMMANDS];
  65. bool parse_command(struct videohub_data *d, char *cmd);
  66. int parse_text_buffer(struct videohub_data *data, char *cmd_buffer);
  67. struct vcmd_param {
  68. char *param;
  69. unsigned int port_no;
  70. };
  71. struct vcmd_entry {
  72. struct videohub_commands *cmd;
  73. struct vcmd_param p1;
  74. struct vcmd_param p2;
  75. bool do_lock;
  76. enum port_lock lock;
  77. enum serial_dir direction;
  78. bool clear_port;
  79. bool reversed_args;
  80. };
  81. void prepare_cmd_entry(struct videohub_data *d, struct vcmd_entry *e);
  82. void format_cmd_text(struct vcmd_entry *e, char *buf, unsigned int bufsz);
  83. void show_cmd(struct videohub_data *d, struct vcmd_entry *e);
  84. #endif