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 kVDevJSON_Name "name" 49 #define kVDevJSON_URLSpec "urlspec" 50 #define kVDevJSON_Disabled "disabled" 51 #define kVDevJSON_Plugin "plugin" 52 #define kVDevJSON_Host "host" 55 #define kLegalSchemeNTV2 "ntv2" 56 #define kLegalSchemeNTV2Local "ntv2local" 59 #define kFuncNameCreateClient "CreateClient" 60 #define kFuncNameCreateServer "CreateServer" 61 #define kFuncNameGetRegInfo "GetRegistrationInfo" 64 #define kNTV2PluginInfoKey_PluginsPath "PluginsPath" 65 #define kNTV2PluginInfoKey_PluginPath "PluginPath" 66 #define kNTV2PluginInfoKey_PluginSigPath "PluginSigPath" 67 #define kNTV2PluginInfoKey_PluginBaseName "PluginBaseName" 68 #define kNTV2PluginInfoKey_Fingerprint "serial number" 69 #define kNTV2PluginInfoKey_Errors "errors" 72 #define kNTV2PluginRegInfoKey_Vendor "Vendor" 73 #define kNTV2PluginRegInfoKey_CommonName "CommonName" 74 #define kNTV2PluginRegInfoKey_OrgUnit "OrgUnit" 75 #define kNTV2PluginRegInfoKey_ShortName "ShortName" 76 #define kNTV2PluginRegInfoKey_LongName "LongName" 77 #define kNTV2PluginRegInfoKey_Description "Description" 78 #define kNTV2PluginRegInfoKey_Copyright "Copyright" 79 #define kNTV2PluginRegInfoKey_NTV2SDKVersion "NTV2SDKVersion" 80 #define kNTV2PluginRegInfoKey_Version "Version" 81 #define kNTV2PluginRegInfoKey_CommitSHA "CommitSHA" 82 #define kNTV2PluginRegInfoKey_ReqParams "RequiredParams" 83 #define kNTV2PluginRegInfoKey_OptParams "OptionalParams" 86 #define kNTV2PluginSigFileKey_X509Certificate "X509Certificate" 87 #define kNTV2PluginSigFileKey_Signature "Signature" 90 #define kNTV2PluginX500AttrKey_CommonName "CN" 91 #define kNTV2PluginX500AttrKey_LocalityName "L" 92 #define kNTV2PluginX500AttrKey_StateOrProvinceName "ST" 93 #define kNTV2PluginX500AttrKey_OrganizationName "O" 94 #define kNTV2PluginX500AttrKey_OrganizationalUnitName "OU" 95 #define kNTV2PluginX500AttrKey_CountryName "C" 117 inline size_t size (
void)
const {
return mDict.
size();}
119 inline bool empty (
void)
const {
return mDict.empty();}
120 inline bool hasKey (
const std::string & inKey)
const {
return mDict.find(inKey) != mDict.end();}
121 std::string valueForKey (
const std::string & inKey)
const;
122 uint16_t u16ValueForKey (
const std::string & inKey,
const uint16_t inDefault = 0)
const;
124 size_t largestKeySize (
void)
const;
125 size_t largestValueSize (
void)
const;
126 std::ostream & Print (std::ostream & oss,
const bool inCompact =
true)
const;
127 bool serialize (std::string & outStr)
const;
133 inline void clear (
void) {mDict.clear();}
135 bool insert (
const std::string & inKey,
const std::string & inValue);
136 inline size_t erase (
const std::string & inKey) {
return hasKey(inKey) ? mDict.erase(inKey) : 0;}
139 bool deserialize (
const std::string & inStr);
140 #if !defined(NTV2_DEPRECATE_17_1) 143 #endif // !defined(NTV2_DEPRECATE_17_1) 147 typedef std::map<std::string, std::string>
Dict;
172 void Reset (
const std::string inSpec =
"");
173 inline const std::string &
DeviceSpec (
void)
const {
return mSpec;}
174 std::string MakeDeviceSpec (
const bool urlEncodeQuery)
const;
175 std::string MakeQueryString (
const bool urlEncode)
const;
178 inline bool Failed (
void)
const {
return DeviceSpec().empty() ?
true : HasErrors();}
182 inline size_t ErrorCount (
void)
const {
return mErrors.size();}
183 inline bool HasErrors (
void)
const {
return ErrorCount() > 0;}
184 inline std::string
Error (
const size_t inIndex = 0)
const {
if (inIndex < mErrors.size())
return mErrors.at(inIndex);
return "";}
187 inline bool HasResult (
const std::string & inKey)
const {
return mResult.hasKey(inKey);}
188 std::string
Result (
const std::string & inKey)
const {
return mResult.valueForKey(inKey);}
189 std::string Resource (
const bool inStripLeadSlash =
true)
const;
190 std::ostream & PrintErrors (std::ostream & oss)
const;
191 std::ostream & Print (std::ostream & oss,
const bool inDumpResults =
false)
const;
192 std::string InfoString (
void)
const;
196 UWord DeviceIndex (
void)
const;
198 inline std::string
QueryParam (
const std::string & inKey)
const {
return mQueryParams.valueForKey(inKey);}
201 static void test (
void);
202 #endif // defined(_DEBUG) 206 bool ParseHexNumber (
size_t & pos, std::string & outToken);
207 bool ParseDecNumber (
size_t & pos, std::string & outToken);
208 bool ParseAlphaNum (
size_t & pos, std::string & outToken,
const std::string & inOtherChars =
"");
209 bool ParseAlphaNumeric (
size_t & pos, std::string & outToken,
const std::string & inOtherChars =
"");
210 bool ParseScheme (
size_t & pos, std::string & outToken);
211 bool ParseSerialNum (
size_t & pos, std::string & outToken);
212 bool ParseDeviceID (
size_t & pos, std::string & outToken);
213 bool ParseModelName (
size_t & pos, std::string & outToken);
214 bool ParseDNSName (
size_t & pos, std::string & outDNSName);
215 bool ParseIPv4Address (
size_t & pos, std::string & outIPv4);
216 bool ParseHostAddressAndPortNumber (
size_t & pos, std::string & outAddr, std::string & outPort);
217 bool ParseResourcePath (
size_t & pos, std::string & outRsrc);
218 bool ParseParamAssignment (
size_t & pos, std::string & outKey, std::string & outValue);
220 inline int LargestResultKey (
void)
const {
return int(mResult.largestKeySize());}
221 inline int LargestResultValue (
void)
const {
return int(mResult.largestValueSize());}
222 inline char CharAt (
const size_t inPos) {
return inPos < mSpec.length() ? mSpec.at(inPos) : 0;}
223 inline size_t SpecLength (
void)
const {
return mSpec.length();}
224 inline size_t CurrentPosition (
void)
const {
return mPos;}
225 inline void AddError (
const std::string & inError) {mErrors.push_back(inError);}
226 static bool IsUpperLetter (
const char inChar);
227 static bool IsLowerLetter (
const char inChar);
228 static bool IsLetter (
const char inChar,
const bool inIncludeUnderscore =
false);
229 static bool IsDecimalDigit (
const char inChar);
230 static bool IsHexDigit (
const char inChar);
231 static bool IsLegalSerialNumChar (
const char inChar);
263 static std::string ShortSDKVersion (
void);
264 static std::string AJAFingerprint (
const bool inLowerCase =
false,
const bool inStripColons =
false);
269 bool SetParams (
const NTV2ConfigParams & inNewParams,
const bool inAugment =
false);
304 virtual std::string HostName (
void)
const {
return ConnectParam(
kConnectParamHost);}
306 virtual std::string
Name (
void)
const {
return "";}
307 virtual std::string Description (
void)
const;
308 virtual std::ostream & Print (std::ostream & oss)
const;
314 virtual bool NTV2Connect (
void);
316 virtual bool NTV2Disconnect (
void);
325 virtual bool HasConnectParam (
const std::string & inParam)
const;
326 virtual std::string ConnectParam (
const std::string & inParam)
const;
327 virtual bool ConnectHasScheme (
void)
const;
334 virtual bool NTV2ReadRegisterRemote (
const ULWord regNum,
ULWord & outRegValue,
const ULWord regMask,
const ULWord regShift);
336 virtual bool NTV2WriteRegisterRemote (
const ULWord regNum,
const ULWord regValue,
const ULWord regMask,
const ULWord regShift);
339 virtual bool NTV2DMATransferRemote (
const NTV2DMAEngine inDMAEngine,
const bool inIsRead,
341 const ULWord inCardOffsetBytes,
const ULWord inNumSegments,
342 const ULWord inSegmentHostPitch,
const ULWord inSegmentCardPitch,
343 const bool inSynchronous);
344 virtual bool NTV2MessageRemote (
NTV2_HEADER * pInMessage);
350 virtual bool NTV2GetBoolParamRemote (
const ULWord inParamID,
ULWord & outValue);
352 virtual bool NTV2GetNumericParamRemote (
const ULWord inParamID,
ULWord & outValue);
353 virtual bool NTV2GetSupportedRemote (
const ULWord inEnumsID,
ULWordSet & outSupported);
373 outDeviceInfos.clear();
377 #if !defined(NTV2_DEPRECATE_16_3) // These functions are going away 383 #endif // !defined(NTV2_DEPRECATE_16_3) 390 virtual bool NTV2OpenRemote (
void);
391 virtual bool NTV2CloseRemote (
void);
394 uint32_t mSpare[1024];
431 virtual std::ostream & Print (std::ostream & oss)
const;
433 virtual inline bool IsRunning (
void)
const {
return mRunning;}
441 virtual bool HasConfigParam (
const std::string & inParam)
const;
442 virtual std::string ConfigParam (
const std::string & inParam)
const;
449 virtual void RunServer (
void);
451 virtual inline void Stop (
void) {mTerminate =
true;}
461 uint32_t mSpare[1024];
507 #if !defined(NTV2_DEPRECATE_16_3) // Don't use these functions going forward 508 typedef NTV2RPCAPI* (*fpCreateNTV2SoftwareDevice) (
void * ,
const std::string & ,
const uint32_t );
509 #endif // !defined(NTV2_DEPRECATE_16_3) 512 #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
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< std::string > NTV2StringList
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
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
std::set< std::string > NTV2StringSet