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" 40 #define kQParamNumWorkers "numworkers" 43 #define kQParamVDevFolderPath "vdevfpath" 44 #define kQParamVDevName "vdevname" 45 #define kQParamVDevFileName "vdevfname" 46 #define kQParamVDevIndex "vdevindex" 49 #define kVDevJSON_Name "name" 50 #define kVDevJSON_URLSpec "urlspec" 51 #define kVDevJSON_Disabled "disabled" 52 #define kVDevJSON_Plugin "plugin" 53 #define kVDevJSON_Host "host" 56 #define kLegalSchemeNTV2 "ntv2" 57 #define kLegalSchemeNTV2Local "ntv2local" 60 #define kFuncNameCreateClient "CreateClient" 61 #define kFuncNameCreateServer "CreateServer" 62 #define kFuncNameGetRegInfo "GetRegistrationInfo" 65 #define kNTV2PluginInfoKey_PluginsPath "PluginsPath" 66 #define kNTV2PluginInfoKey_PluginPath "PluginPath" 67 #define kNTV2PluginInfoKey_PluginSigPath "PluginSigPath" 68 #define kNTV2PluginInfoKey_PluginBaseName "PluginBaseName" 69 #define kNTV2PluginInfoKey_Fingerprint "serial number" 70 #define kNTV2PluginInfoKey_Errors "errors" 73 #define kNTV2PluginRegInfoKey_Vendor "Vendor" 74 #define kNTV2PluginRegInfoKey_CommonName "CommonName" 75 #define kNTV2PluginRegInfoKey_OrgUnit "OrgUnit" 76 #define kNTV2PluginRegInfoKey_ShortName "ShortName" 77 #define kNTV2PluginRegInfoKey_LongName "LongName" 78 #define kNTV2PluginRegInfoKey_Description "Description" 79 #define kNTV2PluginRegInfoKey_Copyright "Copyright" 80 #define kNTV2PluginRegInfoKey_NTV2SDKVersion "NTV2SDKVersion" 81 #define kNTV2PluginRegInfoKey_Version "Version" 82 #define kNTV2PluginRegInfoKey_CommitSHA "CommitSHA" 83 #define kNTV2PluginRegInfoKey_ReqParams "RequiredParams" 84 #define kNTV2PluginRegInfoKey_OptParams "OptionalParams" 87 #define kNTV2PluginSigFileKey_X509Certificate "X509Certificate" 88 #define kNTV2PluginSigFileKey_Signature "Signature" 91 #define kNTV2PluginX500AttrKey_CommonName "CN" 92 #define kNTV2PluginX500AttrKey_LocalityName "L" 93 #define kNTV2PluginX500AttrKey_StateOrProvinceName "ST" 94 #define kNTV2PluginX500AttrKey_OrganizationName "O" 95 #define kNTV2PluginX500AttrKey_OrganizationalUnitName "OU" 96 #define kNTV2PluginX500AttrKey_CountryName "C" 118 inline size_t size (
void)
const {
return mDict.
size();}
120 inline bool empty (
void)
const {
return mDict.empty();}
121 inline bool hasKey (
const std::string & inKey)
const {
return mDict.find(inKey) != mDict.end();}
122 std::string valueForKey (
const std::string & inKey)
const;
123 uint16_t u16ValueForKey (
const std::string & inKey,
const uint16_t inDefault = 0)
const;
125 size_t largestKeySize (
void)
const;
126 size_t largestValueSize (
void)
const;
127 std::ostream & Print (std::ostream & oss,
const bool inCompact =
true)
const;
128 bool serialize (std::string & outStr)
const;
134 inline void clear (
void) {mDict.clear();}
136 bool insert (
const std::string & inKey,
const std::string & inValue);
137 inline size_t erase (
const std::string & inKey) {
return hasKey(inKey) ? mDict.erase(inKey) : 0;}
140 bool deserialize (
const std::string & inStr);
141 #if !defined(NTV2_DEPRECATE_17_1) 144 #endif // !defined(NTV2_DEPRECATE_17_1) 148 typedef std::map<std::string, std::string>
Dict;
173 void Reset (
const std::string inSpec =
"");
174 inline const std::string &
DeviceSpec (
void)
const {
return mSpec;}
175 std::string MakeDeviceSpec (
const bool urlEncodeQuery)
const;
176 std::string MakeQueryString (
const bool urlEncode)
const;
179 inline bool Failed (
void)
const {
return DeviceSpec().empty() ?
true : HasErrors();}
183 inline size_t ErrorCount (
void)
const {
return mErrors.size();}
184 inline bool HasErrors (
void)
const {
return ErrorCount() > 0;}
185 inline std::string
Error (
const size_t inIndex = 0)
const {
if (inIndex < mErrors.size())
return mErrors.at(inIndex);
return "";}
188 inline bool HasResult (
const std::string & inKey)
const {
return mResult.hasKey(inKey);}
189 std::string
Result (
const std::string & inKey)
const {
return mResult.valueForKey(inKey);}
190 std::string Resource (
const bool inStripLeadSlash =
true)
const;
191 std::ostream & PrintErrors (std::ostream & oss)
const;
192 std::ostream & Print (std::ostream & oss,
const bool inDumpResults =
false)
const;
193 std::string InfoString (
void)
const;
197 UWord DeviceIndex (
void)
const;
199 inline std::string
QueryParam (
const std::string & inKey)
const {
return mQueryParams.valueForKey(inKey);}
202 static void test (
void);
203 #endif // defined(_DEBUG) 207 bool ParseHexNumber (
size_t & pos, std::string & outToken);
208 bool ParseDecNumber (
size_t & pos, std::string & outToken);
209 bool ParseAlphaNum (
size_t & pos, std::string & outToken,
const std::string & inOtherChars =
"");
210 bool ParseAlphaNumeric (
size_t & pos, std::string & outToken,
const std::string & inOtherChars =
"");
211 bool ParseScheme (
size_t & pos, std::string & outToken);
212 bool ParseSerialNum (
size_t & pos, std::string & outToken);
213 bool ParseDeviceID (
size_t & pos, std::string & outToken);
214 bool ParseModelName (
size_t & pos, std::string & outToken);
215 bool ParseDNSName (
size_t & pos, std::string & outDNSName);
216 bool ParseIPv4Address (
size_t & pos, std::string & outIPv4);
217 bool ParseHostAddressAndPortNumber (
size_t & pos, std::string & outAddr, std::string & outPort);
218 bool ParseResourcePath (
size_t & pos, std::string & outRsrc);
219 bool ParseParamAssignment (
size_t & pos, std::string & outKey, std::string & outValue);
221 inline int LargestResultKey (
void)
const {
return int(mResult.largestKeySize());}
222 inline int LargestResultValue (
void)
const {
return int(mResult.largestValueSize());}
223 inline char CharAt (
const size_t inPos) {
return inPos < mSpec.length() ? mSpec.at(inPos) : 0;}
224 inline size_t SpecLength (
void)
const {
return mSpec.length();}
225 inline size_t CurrentPosition (
void)
const {
return mPos;}
226 inline void AddError (
const std::string & inError) {mErrors.push_back(inError);}
227 static bool IsUpperLetter (
const char inChar);
228 static bool IsLowerLetter (
const char inChar);
229 static bool IsLetter (
const char inChar,
const bool inIncludeUnderscore =
false);
230 static bool IsDecimalDigit (
const char inChar);
231 static bool IsHexDigit (
const char inChar);
232 static bool IsLegalSerialNumChar (
const char inChar);
264 static std::string ShortSDKVersion (
void);
265 static std::string AJAFingerprint (
const bool inLowerCase =
false,
const bool inStripColons =
false);
270 bool SetParams (
const NTV2ConfigParams & inNewParams,
const bool inAugment =
false);
305 virtual std::string HostName (
void)
const {
return ConnectParam(
kConnectParamHost);}
307 virtual std::string
Name (
void)
const {
return "";}
308 virtual std::string Description (
void)
const;
309 virtual std::ostream & Print (std::ostream & oss)
const;
315 virtual bool NTV2Connect (
void);
317 virtual bool NTV2Disconnect (
void);
326 virtual bool HasConnectParam (
const std::string & inParam)
const;
327 virtual std::string ConnectParam (
const std::string & inParam)
const;
328 virtual bool ConnectHasScheme (
void)
const;
335 virtual bool NTV2ReadRegisterRemote (
const ULWord regNum,
ULWord & outRegValue,
const ULWord regMask,
const ULWord regShift);
337 virtual bool NTV2WriteRegisterRemote (
const ULWord regNum,
const ULWord regValue,
const ULWord regMask,
const ULWord regShift);
340 virtual bool NTV2DMATransferRemote (
const NTV2DMAEngine inDMAEngine,
const bool inIsRead,
342 const ULWord inCardOffsetBytes,
const ULWord inNumSegments,
343 const ULWord inSegmentHostPitch,
const ULWord inSegmentCardPitch,
344 const bool inSynchronous);
345 virtual bool NTV2MessageRemote (
NTV2_HEADER * pInMessage);
351 virtual bool NTV2GetBoolParamRemote (
const ULWord inParamID,
ULWord & outValue);
353 virtual bool NTV2GetNumericParamRemote (
const ULWord inParamID,
ULWord & outValue);
354 virtual bool NTV2GetSupportedRemote (
const ULWord inEnumsID,
ULWordSet & outSupported);
374 outDeviceInfos.clear();
378 #if !defined(NTV2_DEPRECATE_16_3) // These functions are going away 384 #endif // !defined(NTV2_DEPRECATE_16_3) 391 virtual bool NTV2OpenRemote (
void);
392 virtual bool NTV2CloseRemote (
void);
395 uint32_t mSpare[1024];
432 virtual std::ostream & Print (std::ostream & oss)
const;
434 virtual inline bool IsRunning (
void)
const {
return mRunning;}
442 virtual bool HasConfigParam (
const std::string & inParam)
const;
443 virtual std::string ConfigParam (
const std::string & inParam)
const;
450 virtual void RunServer (
void);
452 virtual inline void Stop (
void) {mTerminate =
true;}
462 uint32_t mSpare[1024];
508 #if !defined(NTV2_DEPRECATE_16_3) // Don't use these functions going forward 509 typedef NTV2RPCAPI* (*fpCreateNTV2SoftwareDevice) (
void * ,
const std::string & ,
const uint32_t );
510 #endif // !defined(NTV2_DEPRECATE_16_3) 513 #endif // NTV2NUBACCESS_H Everything needed to call CNTV2Card::ReadRegister or CNTV2Card::WriteRegister functions.
std::string QueryParam(const std::string &inKey) const
uint32_t gLoaderDestructCount
virtual bool NTV2QueryDevices(NTV2StringList &outDeviceInfos, std::string &outErrMsg)
Queries the devices that are accessible on the remote host.
std::ostream & operator<<(std::ostream &oss, const NTV2Dictionary &inDict)
#define kConnectParamDevSerial
Device with this serial number.
Declares the AJALock class.
NTV2Dictionary NTV2ConfigParams
A dictionary of parameters used to configure an RPC server.
bool(* fpGetRegistrationInfo)(const uint32_t, NTV2Dictionary &)
Obtains a plugin's registration information. Starting in SDK 17.1, all plugins must implement this fu...
size_t ErrorCount(void) const
uint32_t gServerDestructCount
NTV2FrameBufferFormat
Identifies a particular video frame buffer pixel format. See Device Frame Buffer Formats for details...
#define NTV2_DEPRECATED_16_3(__f__)
NTV2DeviceIDSerialPairs::const_iterator NTV2DeviceIDSerialPairsConstIter
virtual bool SetConnectParams(const NTV2ConnectParams &inNewParams, const bool inAugment=false)
Replaces or adds to my connect parameters.
const std::string & DeviceSpec(void) const
NTV2RPCClientAPI NTV2RPCAPI
bool HasDeviceSpec(void) const
#define kLegalSchemeNTV2Local
One-stop shop for parsing device specifications. (New in SDK 16.3) I do very little in the way of val...
size_t erase(const std::string &inKey)
Erases the given key and its corresponding value from me, returns 1 if successful, 0 if not.
Dict::const_iterator DictConstIter
Common base class for NTV2RPCClientAPI and NTV2RPCServerAPI.
std::string DeviceModel(void) const
NTV2Channel
These enum values are mostly used to identify a specific widget_framestore. They're also commonly use...
bool hasKey(const std::string &inKey) const
#define kConnectParamDevModel
First device of this model (e.g. 'kona4')
AJALock mParamLock
Mutex to protect mParams.
virtual std::string Name(void) const
uint32_t gClientDestructCount
NTV2Dictionary mParams
Copy of config params passed to my constructor.
#define kConnectParamHost
DNS name, IPv4 or sw device DLL name.
bool IsLocalDevice(void) const
virtual bool SetConfigParams(const NTV2ConfigParams &inNewParams, const bool inAugment=false)
Replaces or adds to my config parameters.
virtual std::ostream & Print(std::ostream &oss) const
bool HasErrors(void) const
An object that can connect to, and operate remote or fake devices. I have three general API groups: ...
NTV2DeviceID
Identifies a specific AJA NTV2 device model number. The NTV2DeviceID is actually the PROM part number...
NTV2Dictionary NTV2ConnectParams
A dictionary of parameters used to connect to remote/fake devices.
uint32_t gLoaderConstructCount
bool SetParams(const NTV2ConfigParams &inNewParams, const bool inAugment=false)
virtual void Stop(void)
Call this to request the server to stop.
const NTV2Dictionary & QueryParams(void) const
virtual std::ostream & Print(std::ostream &oss) const
std::set< std::string > NTV2StringSet
bool HasResult(const std::string &inKey) const
enum _INTERRUPT_ENUMS_ INTERRUPT_ENUMS
std::ostream & Print(std::ostream &oss, const bool inCompact=true) const
Prints human-readable representation to ostream.
bool HasQueryParams(void) const
std::set< ULWord > ULWordSet
A collection of unique ULWord (uint32_t) values.
std::vector< NTV2DeviceIDSerialPair > NTV2DeviceIDSerialPairs
An ordered sequence of NTV2DeviceIDSerialPairs.
All new NTV2 structs start with this common header.
uint32_t gServerConstructCount
virtual bool IsConnected(void) const
uint32_t gPluginConstructCount
Base class of objects that can serve device operation RPCs with NTV2RPCClientAPI instances.
NTV2ConnectParams Results(void) const
virtual bool IsRunning(void) const
std::string DeviceSerial(void) const
NTV2StringList Errors(void) const
bool mTerminate
Set true to stop server.
Describes a user-space buffer on the host computer. I have an address and a length, plus some optional attributes (allocated by SDK?, page-aligned? etc.).
Declares numerous NTV2 utility functions.
uint32_t * mpRefCon
Reserved for internal use.
std::pair< std::string, std::string > NTV2ConnectParam
A parameter used to connect to remote/fake devices.
#define kConnectParamScheme
URL scheme.
std::pair< std::string, std::string > NTV2DictEntry
uint32_t gBaseConstructCount
A simple (not thread-safe) set of key/value pairs. (New in SDK 16.3)
size_t initializeFrom(const Dict &inDict)
bool Successful(void) const
std::string Scheme(void) const
std::pair< std::string, std::string > NTV2DictionaryEntry
std::vector< std::string > NTV2StringList
uint32_t gBaseDestructCount
std::map< std::string, std::string > Dict
std::string Result(const std::string &inKey) const
NTV2DeviceIDSerialPairs::iterator NTV2DeviceIDSerialPairsIter
#define NTV2_DEPRECATED_f(__f__)
uint32_t gPluginDestructCount
std::string Error(const size_t inIndex=0) const
uint32_t gClientConstructCount
std::pair< NTV2DeviceID, ULWord64 > NTV2DeviceIDSerialPair
Identifies a device by its NTV2DeviceID and serial number.
bool HasScheme(void) const