AJA NTV2 SDK  18.0.0.2122
NTV2 SDK 18.0.0.2122
ntv2mbcontroller.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: MIT */
8 #ifndef NTV2MBCONTROLLER_H
9 #define NTV2MBCONTROLLER_H
10 
11 #include "ntv2card.h"
12 #include "ntv2mailbox.h"
13 #include <iostream>
14 #include <vector>
15 
16 enum eMBCmd
17 {
30 };
31 
33 {
36 };
37 
38 enum eSFP
39 {
44 };
45 
46 #define NTV2_IS_VALID_SFP(__sfp__) (((__sfp__) >= SFP_1) && ((__sfp__) < SFP_INVALID))
47 
49 {
54 };
55 
56 typedef enum
57 {
62 
63 typedef struct
64 {
65  uint8_t mac[6];
66 } MACAddr;
67 
68 typedef struct
69 {
70  uint8_t data[64];
71 } SFPMSAData;
72 
73 struct SFPStatus
74 {
75  bool SFP_present; // true indicates SFP plugged in
76  bool SFP_rxLoss; // true indicates loss of signal
77  bool SFP_txFault; // true indicates tx fault
78  bool SFP_linkUp; // true indicates link is up
79 };
80 
81 typedef enum
82 {
89 
90 struct PTPStatus
91 {
92  uint8_t PTP_gmId[8]; // GrandMasterID
93  uint8_t PTP_masterId[8]; // MasterID
94  uint8_t PTP_domain; // domain
95  PTPLockStatus PTP_LockedState; // locked state
96 };
97 
98 
99 // IGMP Control Block
100 #define IGMPCB_REG_STATE 0
101 #define IGMPCB_REG_MCAST_ADDR 1
102 #define IGMPCB_REG_SRC_ADDR 2
103 #define IGMPCB_SIZE 3
104 
105 #define IGMPCB_STATE_USED BIT(0)
106 #define IGMPCB_STATE_ENABLED BIT(1)
107 #define IGMPCB_STATE_BUSY BIT(31) // ignore when busy
108 
109 #define S2022_LINK_A_ACTIVE BIT(31)
110 #define S2022_LINK_B_ACTIVE BIT(30)
111 #define S2022_DUAL_LINK BIT(29)
112 
114 {
115 public:
117 
118  void init();
119 
120  bool operator == ( const IPVNetConfig &other );
121  bool operator != ( const IPVNetConfig &other );
122 
123  uint32_t ipc_ip;
124  uint32_t ipc_subnet;
125  uint32_t ipc_gateway;
126 };
127 
129 {
130 public:
131  CNTV2MBController(CNTV2Card & device);
132 
133 protected:
134  // all these methods block until response received or timeout
135  bool SetMBNetworkConfiguration(eSFP port, std::string ipaddr, std::string netmask,std::string gateway);
136  bool DisableNetworkInterface(eSFP port);
137  bool GetRemoteMAC(std::string remote_IPAddress, eSFP port, NTV2Stream stream, std::string & MACaddress);
138  bool SetIGMPVersion(uint32_t version);
139 
140  void SetIGMPGroup(eSFP port, NTV2Stream stream, uint32_t mcast_addr, uint32_t src_addr, bool enable);
141  void UnsetIGMPGroup(eSFP port, NTV2Stream stream);
142  void EnableIGMPGroup(eSFP port, NTV2Stream stream, bool enable);
143 
144  bool SetTxLinkState(NTV2Channel channel, bool sfp1Enable, bool sfp2Enable);
145  bool GetTxLinkState(NTV2Channel channel, bool & sfp1Enable, bool & sfp2Enable);
146  bool SetRxLinkState(NTV2Channel channel, bool sfp1Enable, bool sfp2Enable);
147  bool GetRxLinkState(NTV2Channel channel, bool & sfp1Enable, bool & sfp2Enable);
148 
149  bool SetDualLinkMode(bool enable);
150  bool GetDualLinkMode(bool & enable);
151 
152  bool SetRxMatch(NTV2Channel channel, eSFP link, uint8_t match);
153  bool GetRxMatch(NTV2Channel channel, eSFP link, uint8_t & match);
154 
155  bool SetSFPActive(eSFP sfp);
156  bool SetSFPInactive(eSFP sfp);
157  bool GetSFPActive(eSFP sfp);
158 
159  bool SetTxFormat(NTV2Channel chan, NTV2VideoFormat fmt);
160  bool GetTxFormat(NTV2Channel chan, NTV2VideoFormat & fmt);
161 
162  uint64_t GetNTPTimestamp();
163  bool PushSDP(std::string filename, std::stringstream & sdpstream);
164  bool GetSDP(std::string url, std::string & sdp);
165 
166  bool GetSFPInfo(eSFP port, SFPMSAData & sfpdata);
167 
168  bool SetLLDPInfo(std::string sysname);
169  bool GetLLDPInfo(std::string &chassisId0, std::string &portId0,
170  std::string &chassisId1, std::string &portId1);
171 
172 
173 private:
174  eArpState GetRemoteMACFromArpTable(std::string remote_IPAddress, eSFP port, NTV2Stream stream, std::string & MACaddress);
175  bool SendArpRequest(std::string remote_IPAddress, eSFP port);
176 
177  void splitResponse(const std::string response, std::vector<std::string> & results);
178  bool getDecimal(const std::string & resp, const std::string & parm, uint32_t & result);
179  bool getHex(const std::string & resp, const std::string & parm, uint32_t &result);
180  bool getString(const std::string & resp, const std::string & parm, std::string & result);
181  uint32_t getIGMPCBOffset(eSFP port, NTV2Stream stream);
182 
183 private:
184 };
185 
186 #endif // NTV2MBCONTROLLER_H
uint8_t PTP_masterId[8]
I interrogate and control an AJA video/audio capture/playout device.
Definition: ntv2card.h:28
enum _NTV2VideoFormat NTV2VideoFormat
Identifies a particular video format.
bool operator!=(const IPVNetConfig &other)
bool operator==(const IPVNetConfig &other)
PTPLockStatus PTP_LockedState
NTV2Channel
These enum values are mostly used to identify a specific widget_framestore. They&#39;re also commonly use...
Definition: ntv2enums.h:1357
eNTV2PacketInterval
uint8_t PTP_domain
eMBCmd
eIGMPVersion_t
eArpState
uint32_t ipc_subnet
#define AJAExport
Definition: export.h:33
Declares the CNTV2MailBox class.
PTPLockStatus
NTV2Stream
Identifies a specific IP-based data stream.
Definition: ntv2enums.h:1407
Declares the CNTV2Card class.
uint8_t PTP_gmId[8]
uint32_t ipc_gateway