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.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  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 21
  16. enum vcmd {
  17. CMD_PROTOCOL_PREAMBLE,
  18. CMD_VIDEOHUB_DEVICE,
  19. CMD_INPUT_LABELS,
  20. CMD_OUTPUT_LABELS,
  21. CMD_VIDEO_OUTPUT_LOCKS,
  22. CMD_VIDEO_OUTPUT_ROUTING,
  23. CMD_VIDEO_INPUT_STATUS,
  24. CMD_VIDEO_OUTPUT_STATUS,
  25. CMD_MONITORING_OUTPUT_LABELS,
  26. CMD_MONITORING_OUTPUT_LOCKS,
  27. CMD_MONITORING_OUTPUT_ROUTING,
  28. CMD_SERIAL_PORT_LABELS,
  29. CMD_SERIAL_PORT_LOCKS,
  30. CMD_SERIAL_PORT_ROUTING,
  31. CMD_SERIAL_PORT_STATUS,
  32. CMD_SERIAL_PORT_DIRECTIONS,
  33. CMD_PROCESSING_UNIT_ROUTING,
  34. CMD_PROCESSING_UNIT_LOCKS,
  35. CMD_PING,
  36. CMD_ACK,
  37. CMD_NAK = (NUM_COMMANDS - 1),
  38. };
  39. enum cmd_flags {
  40. PARSE_NONE, /* The result if this command needs no parsing */
  41. PARSE_CUSTOM, /* Use custom parser for this command */
  42. PARSE_LABEL, /* Parse [port_num] [port_text] */
  43. PARSE_STATUS, /* Parse [port_num] [port_status] */
  44. PARSE_ROUTE, /* Parse [port_num] [dest_port] */
  45. PARSE_LOCK, /* Parse [port_num] [dest_slot] */
  46. PARSE_DIR, /* Parse [port_num] [port_direction] - for serial ports */
  47. };
  48. struct videohub_commands {
  49. enum vcmd cmd;
  50. enum cmd_flags type;
  51. size_t ports1;
  52. size_t ports2;
  53. const char *port_id1;
  54. const char *port_id2;
  55. const char *opt_prefix;
  56. bool allow_disconnect;
  57. };
  58. extern struct videohub_commands videohub_commands[NUM_COMMANDS];
  59. bool parse_command(struct videohub_data *d, char *cmd);
  60. int parse_text_buffer(struct videohub_data *data, char *cmd_buffer);
  61. struct vcmd_entry {
  62. struct videohub_commands *cmd;
  63. char *param1;
  64. char *param2;
  65. unsigned int port_no1;
  66. unsigned int port_no2;
  67. bool do_lock;
  68. enum port_lock lock;
  69. enum serial_dir direction;
  70. bool clear_port;
  71. };
  72. void prepare_cmd_entry(struct videohub_data *d, struct vcmd_entry *e);
  73. void format_cmd_text(struct vcmd_entry *e, char *buf, unsigned int bufsz);
  74. void show_cmd(struct videohub_data *d, struct vcmd_entry *e);
  75. #endif