 |
AJA NTV2 SDK
18.0.0.2717
NTV2 SDK 18.0.0.2717
|
Go to the documentation of this file.
8 #ifndef NTV2NUBACCESS_H
9 #define NTV2NUBACCESS_H
24 #define kConnectParamScheme "scheme"
25 #define kConnectParamHost "host"
26 #define kConnectParamPort "port"
27 #define kConnectParamDevIndex "deviceindex"
28 #define kConnectParamDevSerial "deviceserial"
29 #define kConnectParamDevModel "devicemodel"
30 #define kConnectParamDevID "deviceid"
31 #define kConnectParamResource "resourcePath"
32 #define kConnectParamQuery "query"
35 #define kQParamVerboseLogging "verbose"
36 #define kQParamLogToStdout "stdout"
37 #define kQParamShowX509Cert "showcert"
38 #define kQParamShowParams "showparams"
39 #define kQParamDebugRegistry "debugregistry"
42 #define kQParamVDevFolderPath "vdevfpath"
43 #define kQParamVDevName "vdevname"
44 #define kQParamVDevFileName "vdevfname"
45 #define kQParamVDevIndex "vdevindex"
48 #define kLegalSchemeNTV2 "ntv2"
49 #define kLegalSchemeNTV2Local "ntv2local"
52 #define kFuncNameCreateClient "CreateClient"
53 #define kFuncNameCreateServer "CreateServer"
54 #define kFuncNameGetRegInfo "GetRegistrationInfo"
57 #define kNTV2PluginInfoKey_PluginsPath "PluginsPath"
58 #define kNTV2PluginInfoKey_PluginPath "PluginPath"
59 #define kNTV2PluginInfoKey_PluginSigPath "PluginSigPath"
60 #define kNTV2PluginInfoKey_PluginBaseName "PluginBaseName"
61 #define kNTV2PluginInfoKey_Fingerprint "serial number"
62 #define kNTV2PluginInfoKey_Errors "errors"
65 #define kNTV2PluginRegInfoKey_Vendor "Vendor"
66 #define kNTV2PluginRegInfoKey_CommonName "CommonName"
67 #define kNTV2PluginRegInfoKey_OrgUnit "OrgUnit"
68 #define kNTV2PluginRegInfoKey_ShortName "ShortName"
69 #define kNTV2PluginRegInfoKey_LongName "LongName"
70 #define kNTV2PluginRegInfoKey_Description "Description"
71 #define kNTV2PluginRegInfoKey_Copyright "Copyright"
72 #define kNTV2PluginRegInfoKey_NTV2SDKVersion "NTV2SDKVersion"
73 #define kNTV2PluginRegInfoKey_Version "Version"
74 #define kNTV2PluginRegInfoKey_CommitSHA "CommitSHA"
75 #define kNTV2PluginRegInfoKey_ReqParams "RequiredParams"
76 #define kNTV2PluginRegInfoKey_OptParams "OptionalParams"
79 #define kNTV2PluginSigFileKey_X509Certificate "X509Certificate"
80 #define kNTV2PluginSigFileKey_Signature "Signature"
83 #define kNTV2PluginX500AttrKey_CommonName "CN"
84 #define kNTV2PluginX500AttrKey_LocalityName "L"
85 #define kNTV2PluginX500AttrKey_StateOrProvinceName "ST"
86 #define kNTV2PluginX500AttrKey_OrganizationName "O"
87 #define kNTV2PluginX500AttrKey_OrganizationalUnitName "OU"
88 #define kNTV2PluginX500AttrKey_CountryName "C"
110 inline size_t size (
void)
const {
return mDict.size();}
112 inline bool empty (
void)
const {
return mDict.empty();}
113 inline bool hasKey (
const std::string & inKey)
const {
return mDict.find(inKey) != mDict.end();}
114 std::string valueForKey (
const std::string & inKey)
const;
115 uint16_t u16ValueForKey (
const std::string & inKey,
const uint16_t inDefault = 0)
const;
117 size_t largestKeySize (
void)
const;
118 size_t largestValueSize (
void)
const;
119 std::ostream & Print (std::ostream & oss,
const bool inCompact =
true)
const;
120 bool serialize (std::string & outStr)
const;
126 inline void clear (
void) {mDict.clear();}
128 bool insert (
const std::string & inKey,
const std::string & inValue);
129 inline size_t erase (
const std::string & inKey) {
return hasKey(inKey) ? mDict.erase(inKey) : 0;}
132 bool deserialize (
const std::string & inStr);
133 #if !defined(NTV2_DEPRECATE_17_1)
136 #endif // !defined(NTV2_DEPRECATE_17_1)
140 typedef std::map<std::string, std::string>
Dict;
165 void Reset (
const std::string inSpec =
"");
166 inline const std::string & DeviceSpec (
void)
const {
return mSpec;}
167 std::string MakeDeviceSpec (
const bool urlEncodeQuery)
const;
168 std::string MakeQueryString (
const bool urlEncode)
const;
169 inline bool HasDeviceSpec (
void)
const {
return !DeviceSpec().empty();}
170 inline bool Successful (
void)
const {
return !Failed();}
171 inline bool Failed (
void)
const {
return DeviceSpec().empty() ?
true : HasErrors();}
175 inline size_t ErrorCount (
void)
const {
return mErrors.size();}
176 inline bool HasErrors (
void)
const {
return ErrorCount() > 0;}
177 inline std::string Error (
const size_t inIndex = 0)
const {
if (inIndex < mErrors.size())
return mErrors.at(inIndex);
return "";}
180 inline bool HasResult (
const std::string & inKey)
const {
return mResult.hasKey(inKey);}
181 std::string Result (
const std::string & inKey)
const {
return mResult.
valueForKey(inKey);}
182 std::string Resource (
const bool inStripLeadSlash =
true)
const;
183 std::ostream & PrintErrors (std::ostream & oss)
const;
184 std::ostream & Print (std::ostream & oss,
const bool inDumpResults =
false)
const;
185 std::string InfoString (
void)
const;
189 UWord DeviceIndex (
void)
const;
190 inline const NTV2Dictionary & QueryParams (
void)
const {
return mQueryParams;}
191 inline std::string QueryParam (
const std::string & inKey)
const {
return mQueryParams.
valueForKey(inKey);}
192 inline bool HasQueryParams (
void)
const {
return !QueryParams().empty();}
194 static void test (
void);
195 #endif // defined(_DEBUG)
199 bool ParseHexNumber (
size_t & pos, std::string & outToken);
200 bool ParseDecNumber (
size_t & pos, std::string & outToken);
201 bool ParseAlphaNum (
size_t & pos, std::string & outToken,
const std::string & inOtherChars =
"");
202 bool ParseAlphaNumeric (
size_t & pos, std::string & outToken,
const std::string & inOtherChars =
"");
203 bool ParseScheme (
size_t & pos, std::string & outToken);
204 bool ParseSerialNum (
size_t & pos, std::string & outToken);
205 bool ParseDeviceID (
size_t & pos, std::string & outToken);
206 bool ParseModelName (
size_t & pos, std::string & outToken);
207 bool ParseDNSName (
size_t & pos, std::string & outDNSName);
208 bool ParseIPv4Address (
size_t & pos, std::string & outIPv4);
209 bool ParseHostAddressAndPortNumber (
size_t & pos, std::string & outAddr, std::string & outPort);
210 bool ParseResourcePath (
size_t & pos, std::string & outRsrc);
211 bool ParseParamAssignment (
size_t & pos, std::string & outKey, std::string & outValue);
213 inline int LargestResultKey (
void)
const {
return int(mResult.largestKeySize());}
214 inline int LargestResultValue (
void)
const {
return int(mResult.largestValueSize());}
215 inline char CharAt (
const size_t inPos) {
return inPos < mSpec.length() ? mSpec.at(inPos) : 0;}
216 inline size_t SpecLength (
void)
const {
return mSpec.length();}
217 inline size_t CurrentPosition (
void)
const {
return mPos;}
218 inline void AddError (
const std::string & inError) {mErrors.push_back(inError);}
219 static bool IsUpperLetter (
const char inChar);
220 static bool IsLowerLetter (
const char inChar);
221 static bool IsLetter (
const char inChar,
const bool inIncludeUnderscore =
false);
222 static bool IsDecimalDigit (
const char inChar);
223 static bool IsHexDigit (
const char inChar);
224 static bool IsLegalSerialNumChar (
const char inChar);
244 static std::string ShortSDKVersion (
void);
245 static std::string AJAFingerprint (
const bool inLowerCase =
false,
const bool inStripColons =
false);
250 bool SetParams (
const NTV2ConfigParams & inNewParams,
const bool inAugment =
false);
285 virtual std::string HostName (
void)
const {
return ConnectParam(
kConnectParamHost);}
287 virtual std::string Name (
void)
const {
return "";}
288 virtual std::string Description (
void)
const;
289 virtual std::ostream & Print (std::ostream & oss)
const;
295 virtual bool NTV2Connect (
void);
297 virtual bool NTV2Disconnect (
void);
298 virtual bool IsConnected (
void)
const {
return false;}
306 virtual bool HasConnectParam (
const std::string & inParam)
const;
307 virtual std::string ConnectParam (
const std::string & inParam)
const;
308 virtual bool ConnectHasScheme (
void)
const;
309 virtual inline bool SetConnectParams (
const NTV2ConnectParams & inNewParams,
const bool inAugment =
false) {
return !IsConnected() &&
SetParams(inNewParams, inAugment);}
315 virtual bool NTV2ReadRegisterRemote (
const ULWord regNum,
ULWord & outRegValue,
const ULWord regMask,
const ULWord regShift);
317 virtual bool NTV2WriteRegisterRemote (
const ULWord regNum,
const ULWord regValue,
const ULWord regMask,
const ULWord regShift);
320 virtual bool NTV2DMATransferRemote (
const NTV2DMAEngine inDMAEngine,
const bool inIsRead,
322 const ULWord inCardOffsetBytes,
const ULWord inNumSegments,
323 const ULWord inSegmentHostPitch,
const ULWord inSegmentCardPitch,
324 const bool inSynchronous);
325 virtual bool NTV2MessageRemote (
NTV2_HEADER * pInMessage);
331 virtual bool NTV2GetBoolParamRemote (
const ULWord inParamID,
ULWord & outValue);
333 virtual bool NTV2GetNumericParamRemote (
const ULWord inParamID,
ULWord & outValue);
334 virtual bool NTV2GetSupportedRemote (
const ULWord inEnumsID,
ULWordSet & outSupported);
354 outDeviceInfos.clear();
358 #if !defined(NTV2_DEPRECATE_16_3) // These functions are going away
360 virtual bool NTV2DriverGetBuildInformationRemote (
BUILD_INFO_STRUCT & buildInfo);
362 const UWord signalMask,
const bool testPatDMAEnb,
const ULWord testPatNum);
363 virtual bool NTV2ReadRegisterMultiRemote (
const ULWord numRegs,
ULWord & outFailedRegNum,
NTV2RegInfo outRegs[]);
364 virtual bool NTV2GetDriverVersionRemote (
ULWord & outDriverVersion);
365 #endif // !defined(NTV2_DEPRECATE_16_3)
372 virtual bool NTV2OpenRemote (
void);
373 virtual bool NTV2CloseRemote (
void);
376 uint32_t mSpare[1024];
413 virtual std::ostream & Print (std::ostream & oss)
const;
415 virtual inline bool IsRunning (
void)
const {
return mRunning;}
423 virtual bool HasConfigParam (
const std::string & inParam)
const;
424 virtual std::string ConfigParam (
const std::string & inParam)
const;
425 virtual inline bool SetConfigParams (
const NTV2ConfigParams & inNewParams,
const bool inAugment =
false) {
return SetParams(inNewParams, inAugment);}
431 virtual void RunServer (
void);
433 virtual inline void Stop (
void) {mTerminate =
true;}
443 uint32_t mSpare[1024];
489 #if !defined(NTV2_DEPRECATE_16_3) // Don't use these functions going forward
490 typedef NTV2RPCAPI* (*fpCreateNTV2SoftwareDevice) (
void * ,
const std::string & ,
const uint32_t );
491 #endif // !defined(NTV2_DEPRECATE_16_3)
494 #endif // NTV2NUBACCESS_H
NTV2Dictionary NTV2ConfigParams
A dictionary of parameters used to configure an RPC server.
#define kLegalSchemeNTV2Local
enum _INTERRUPT_ENUMS_ INTERRUPT_ENUMS
uint32_t gClientConstructCount
std::pair< NTV2DeviceID, ULWord64 > NTV2DeviceIDSerialPair
Identifies a device by its NTV2DeviceID and serial number.
std::set< std::string > NTV2StringSet
NTV2Channel
These enum values are mostly used to identify a specific widget_framestore. They're also commonly use...
Describes a user-space buffer on the host computer. I have an address and a length,...
size_t initializeFrom(const Dict &inDict)
Base class of objects that can serve device operation RPCs with NTV2RPCClientAPI instances.
Common base class for NTV2RPCClientAPI and NTV2RPCServerAPI.
NTV2DeviceIDSerialPairs::const_iterator NTV2DeviceIDSerialPairsConstIter
bool SetParams(const NTV2ConfigParams &inNewParams, const bool inAugment=false)
NTV2DeviceID
Identifies a specific AJA NTV2 device model number. The NTV2DeviceID is actually the PROM part number...
NTV2FrameBufferFormat
Identifies a particular video frame buffer format. See Device Frame Buffer Formats for details.
std::ostream & Print(std::ostream &oss, const bool inCompact=true) const
Prints human-readable representation to ostream.
uint32_t gClientDestructCount
uint32_t gServerDestructCount
std::string DeviceModel(void) const
NTV2RPCClientAPI NTV2RPCAPI
uint32_t gLoaderConstructCount
#define kConnectParamDevModel
First device of this model (e.g. 'kona4')
NTV2Dictionary mParams
Copy of config params passed to my constructor.
std::set< ULWord > ULWordSet
A collection of unique ULWord (uint32_t) values.
Declares the AJALock class.
NTV2Dictionary NTV2ConnectParams
A dictionary of parameters used to connect to remote/fake devices.
std::vector< NTV2DeviceIDSerialPair > NTV2DeviceIDSerialPairs
An ordered sequence of NTV2DeviceIDSerialPairs.
#define kConnectParamHost
DNS name, IPv4 or sw device DLL name.
virtual std::ostream & Print(std::ostream &oss) const
bool mTerminate
Set true to stop server.
virtual bool NTV2QueryDevices(NTV2StringList &outDeviceInfos, std::string &outErrMsg)
Queries the devices that are accessible on the remote host.
All new NTV2 structs start with this common header.
Declares numerous NTV2 utility functions.
uint32_t gServerConstructCount
AJALock mParamLock
Mutex to protect mParams.
uint32_t gBaseConstructCount
Dict::const_iterator DictConstIter
std::vector< std::string > NTV2StringList
#define kConnectParamScheme
URL scheme.
One-stop shop for parsing device specifications. (New in SDK 16.3) I do very little in the way of val...
std::pair< std::string, std::string > NTV2DictEntry
std::pair< std::string, std::string > NTV2DictionaryEntry
uint32_t gPluginConstructCount
#define NTV2_DEPRECATED_f(__f__)
Everything needed to call CNTV2Card::ReadRegister or CNTV2Card::WriteRegister functions.
std::pair< std::string, std::string > NTV2ConnectParam
A parameter used to connect to remote/fake devices.
uint32_t gPluginDestructCount
uint32_t gBaseDestructCount
NTV2DeviceIDSerialPairs::iterator NTV2DeviceIDSerialPairsIter
std::string DeviceSerial(void) const
virtual std::ostream & Print(std::ostream &oss) const
#define kConnectParamDevSerial
Device with this serial number.
bool(* fpGetRegistrationInfo)(const uint32_t, NTV2Dictionary &)
Obtains a plugin's registration information. Starting in SDK 17.1, all plugins must implement this fu...
An object that can connect to, and operate remote or fake devices. I have three general API groups:
std::string valueForKey(const std::string &inKey) const
uint32_t * mpRefCon
Reserved for internal use.
A simple (not thread-safe) set of key/value pairs. (New in SDK 16.3)
std::map< std::string, std::string > Dict
uint32_t gLoaderDestructCount
std::ostream & operator<<(std::ostream &oss, const NTV2Dictionary &inDict)