Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
en:software:qnet_sdk [2014/12/15 15:22] – qem205 | en:software:qnet_sdk [2022/03/09 15:34] (current) – qem202 | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== QNet-SDK ====== | ||
+ | ====== - Introduction ====== | ||
+ | |||
+ | QNet-SDK is a set of software interfaces (API), libraries, programs and demos released with [[en: | ||
+ | It provides an easy way to develop PC applications including communication with Qem devices that are connected with QNet for third-party software developers. | ||
+ | |||
+ | QNet is a network used to connect Qem devices.\\ | ||
+ | It use a software called QRM (Qem Resources Manager) to manage connection resources.\\ | ||
+ | |||
+ | To be used the QNet-SDK require that the [[en: | ||
+ | |||
+ | ====== - QNet Basics ====== | ||
+ | |||
+ | QNet implements the concept of distribution and de-localization of connection services, in this way it is possible to achieve a local or remote Qem device exactly the same way, making the implementation of a communication program and its use really very simple. | ||
+ | |||
+ | QNet is composed by many parts listed below: | ||
+ | |||
+ | * The nodes. | ||
+ | * The QNet cloud. | ||
+ | * The Qem devices. | ||
+ | * The resources ID. | ||
+ | * The signatures keys. | ||
+ | * The API interfaces to connect all. | ||
+ | |||
+ | Follow a representative image of entire system: | ||
+ | |||
+ | {{: | ||
+ | |||
+ | A node is an execution instance of the QRM program or a [[en: | ||
+ | A node is identified by a special ID in the cloud. \\ | ||
+ | A node can be connected or disconnected from the cloud. \\ | ||
+ | In the cloud, there may be multiple nodes simultaneously. \\ | ||
+ | In the cloud the nodes are visible only when connected. \\ | ||
+ | |||
+ | A resource is an access point to communicate with a Qem device in which all connection parameters with the same are specified. \\ | ||
+ | A node has a list of local resources and if connected to the cloud can access the public resources of other nodes connected to the cloud. \\ | ||
+ | A node is called local when accessed directly via its IP address: Port. \\ | ||
+ | A node is called remote when accessed, from a local node, using the capabilities of the cloud. | ||
+ | |||
+ | ====== - QNetAccessLibrary API ====== | ||
+ | |||
+ | ==== - ClientNode01 Properties ==== | ||
+ | |||
+ | ^ Property Name ^ OLE Data Type ^ Access Mode ^ Description ^ | ||
+ | | Active | ||
+ | | Host | ||
+ | | Port | ||
+ | | ErrorCode | ||
+ | | ErrorMessage | ||
+ | | ProjectChecksumCode | ||
+ | | ProjectChecksumConfiguration | ||
+ | | ProjectChecksumSources | ||
+ | | ProjectChecksumSymbols | ||
+ | | TargetChecksumCode | ||
+ | | TargetChecksumConfiguration | ||
+ | | TargetChecksumSources | ||
+ | | TargetChecksumSymbols | ||
+ | |||
+ | ==== - ClientNode01 Methods ==== | ||
+ | |||
+ | ^ Method Name ^ Return Value ^ Description ^ | ||
+ | | OpenConnection | ||
+ | | CloseConnection | ||
+ | | CheckConnection | ||
+ | | LoadFromFile | ||
+ | | ReadSimple | ||
+ | | ReadArray | ||
+ | | ReadArrayRange | ||
+ | | ReadDGDataProgram | ||
+ | | ReadDGStep | ||
+ | | ReadDevice | ||
+ | | WriteSimple | ||
+ | | WriteArray | ||
+ | | WriteArrayRange | ||
+ | | WriteDGDataProgram | ||
+ | | WriteDGStep | ||
+ | | WriteDevice | ||
+ | | GetCpuState | ||
+ | |||
+ | ==== - Data Types ==== | ||
+ | |||
+ | ** SignalCode ** | ||
+ | ^ Enum ^ Ordinal ^ Description ^ | ||
+ | | sigcNone | ||
+ | | sigcGenericError | ||
+ | | sigcErrorOpeningFile | ||
+ | | sigcErrorMissingCOMObject | ||
+ | | sigcConnectionError | ||
+ | | sigcClientConnectionError | ||
+ | | sigcResourceDontExistOrAlreadyInUse | 6 | Required resource is don't exist or already in use. | | ||
+ | | sigcErrorSymbolNameNotFound | ||
+ | | sigcErrorDeviceNameNotFound | ||
+ | | sigcErrorIndexOutOfBounds | ||
+ | |||
+ | ** CpuState ** | ||
+ | ^ Enum ^ Ordinal ^ Description ^ | ||
+ | | cpusInit | ||
+ | | cpusReset | ||
+ | | cpusReady | ||
+ | | cpusRun | ||
+ | | cpusStop | ||
+ | | cpusErrorBus | ||
+ | | cpusErrorChecksumData | ||
+ | | cpusErrorIndexOutOfBounds | ||
+ | | cpusErrorProgramOverRange | ||
+ | | cpusErrorStepOverRange | ||
+ | | cpusErrorDivisionByZero | ||
+ | | cpusErrorSyntax | ||
+ | | cpusErrorWatchdogBus | ||
+ | | cpusErrorStack | ||
+ | | cpusUndefined | ||
+ | |||
+ | ==== - Active ==== | ||
+ | |||
+ | The //Active// property can be used to get state of connection channel between ClientNode01 object and QRM server pointed to the TCP/IP port defined with //Host// and //Port// properties.\\ | ||
+ | ==== - Host ==== | ||
+ | |||
+ | The //Host// property is used to define in what IP address the QRM TCP/IP server is listening for a connection with ClientNode01.\\ | ||
+ | |||
+ | The default value is ' | ||
+ | The //Host// property SHOULD be set BEFORE to set Active to True or call OpenConnection() method.\\ | ||
+ | The //Host// property can be either numeric IP string or an URL (that require a DNS server running). | ||
+ | |||
+ | ==== - Port ==== | ||
+ | |||
+ | The //Port// property is used to define in what IP port the QRM TCP/IP server is listening for a connection with ClientNode01.\\ | ||
+ | |||
+ | The default value is 3000, but is possible to reach any QRM available in a public WAN/LAN address using any different port.\\ | ||
+ | The //Port// property SHOULD be set BEFORE to set Active to True or call OpenConnection() method.\\ | ||
+ | |||
+ | ==== - ErrorCode ==== | ||
+ | |||
+ | In the // | ||
+ | |||
+ | ==== - ErrorMessage ==== | ||
+ | |||
+ | In the // | ||
+ | |||
+ | ==== - ProjectChecksumCode ==== | ||
+ | |||
+ | The // | ||
+ | |||
+ | ==== - ProjectChecksumConfiguration ==== | ||
+ | |||
+ | The // | ||
+ | |||
+ | ==== - ProjectChecksumSources ==== | ||
+ | |||
+ | The // | ||
+ | |||
+ | ==== - ProjectChecksumSymbols ==== | ||
+ | |||
+ | The // | ||
+ | |||
+ | ==== - TargetChecksumCode ==== | ||
+ | |||
+ | The // | ||
+ | |||
+ | ==== - TargetChecksumConfiguration ==== | ||
+ | |||
+ | The // | ||
+ | |||
+ | ==== - TargetChecksumSources ==== | ||
+ | |||
+ | The // | ||
+ | |||
+ | ==== - TargetChecksumSymbols ==== | ||
+ | |||
+ | The // | ||
+ | |||
+ | ==== - OpenConnection ==== | ||
+ | |||
+ | The // | ||
+ | |||
+ | A Resource ID is a string data which can be obtained clicking with right mouse key upon resource name in the QRM resource list and choosing the menu 'Copy Resource ID to Clipboard' | ||
+ | At this point in the Clipboard you will have a string like that: // | ||
+ | |||
+ | <code idl> | ||
+ | |||
+ | ^ Argument ^ Data Type ^ Description ^ | ||
+ | | Resource ID | BSTR | Is the Resource ID of a device' | ||
+ | |||
+ | **PS**: remember Resource ID is a UNIQUE ID so there will be no other resources with the same ID in all the cloud. | ||
+ | |||
+ | **PS**: OpenConnection try implicitly to put Active property to True if is in False state, where CloseConnection try implicitly to put Active property to False if in True state. | ||
+ | |||
+ | ==== - CloseConnection ==== | ||
+ | |||
+ | The // | ||
+ | |||
+ | <code idl> | ||
+ | ==== - CheckConnection ==== | ||
+ | |||
+ | <code idl> | ||
+ | |||
+ | ==== - LoadFromFile ==== | ||
+ | |||
+ | <code idl> | ||
+ | |||
+ | ==== - ReadSimple ==== | ||
+ | |||
+ | <code idl> | ||
+ | |||
+ | ==== - ReadArray ==== | ||
+ | |||
+ | <code idl> | ||
+ | |||
+ | ==== - ReadArrayRange ==== | ||
+ | |||
+ | <code idl> | ||
+ | |||
+ | ==== - ReadDGDataProgram ==== | ||
+ | |||
+ | <code idl> | ||
+ | |||
+ | ==== - ReadDGStep ==== | ||
+ | |||
+ | <code idl> | ||
+ | |||
+ | ==== - ReadDevice ==== | ||
+ | |||
+ | <code idl> | ||
+ | |||
+ | ==== - WriteSimple ==== | ||
+ | |||
+ | <code idl> | ||
+ | |||
+ | ==== - WriteArray ==== | ||
+ | |||
+ | <code idl> | ||
+ | |||
+ | ==== - WriteArrayRange ==== | ||
+ | |||
+ | <code idl> | ||
+ | |||
+ | ==== - WriteDGDataProgram ==== | ||
+ | |||
+ | <code idl> | ||
+ | |||
+ | ==== - WriteDGStep ==== | ||
+ | |||
+ | <code idl> | ||
+ | |||
+ | ==== - WriteDevice ==== | ||
+ | |||
+ | <code idl> | ||
+ | |||
+ | ===== - ClientNode Interface ===== | ||
+ | |||
+ | Will follow the IDL representation of ClientNode Interface to use if you would like to manually access it with IDispatch. | ||
+ | |||
+ | <code idl> | ||
+ | [ | ||
+ | uuid(A58FB5BD-8704-4746-AC0D-B9F34701BC4A), | ||
+ | version(1.0), | ||
+ | helpstring(" | ||
+ | dual | ||
+ | ] | ||
+ | dispinterface IClientNode01 { | ||
+ | properties: | ||
+ | methods: | ||
+ | [id(0x000000c9), | ||
+ | [id(0x000000c9), | ||
+ | [id(0x000000ca), | ||
+ | [id(0x000000ca), | ||
+ | [id(0x000000cb), | ||
+ | [id(0x000000cb), | ||
+ | [id(0x000000cc)] | ||
+ | [id(0x000000ce), | ||
+ | [id(0x000000cd), | ||
+ | [id(0x000000cf), | ||
+ | [id(0x000000d0), | ||
+ | [id(0x000000d1), | ||
+ | [id(0x000000d2), | ||
+ | [id(0x000000d3), | ||
+ | [id(0x000000d4), | ||
+ | [id(0x000000d5)] | ||
+ | [id(0x000000d6)] | ||
+ | [id(0x000000d7)] | ||
+ | [id(0x000000d8)] | ||
+ | [id(0x000000d9)] | ||
+ | [id(0x000000da)] | ||
+ | [id(0x000000db)] | ||
+ | [id(0x000000dc)] | ||
+ | [id(0x000000dd)] | ||
+ | [id(0x000000de)] | ||
+ | [id(0x000000df)] | ||
+ | [id(0x000000e0)] | ||
+ | [id(0x000000e1)] | ||
+ | [id(0x000000e2), | ||
+ | [id(0x000000e3), | ||
+ | [id(0x000000e4)] | ||
+ | [id(0x000000e5)] | ||
+ | [id(0x000000E6)] | ||
+ | }; | ||
+ | </ | ||
+ | ===== - Code Samples ===== | ||
+ | |||
+ | Will follow in this chapter some simple samples to understand how to use the QNet-SDK interfaces.\\ | ||
+ | The QNet-SDK interfaces can be used with any programming language and IDE which support the COM specification and specifically the [[http:// | ||
+ | For the following samples was used a 32 bit Windows 7 machine with Microsoft Visual Studio Express 2012 and the Visual Basic.NET language.\\ | ||
+ | The tool is freely downloadable from following link [[http:// | ||
+ | |||
+ | Is not goal of these pages "to be guide" on how use IDE and COM interfaces in programming language which are you are used to.\\ | ||
+ | |||
+ | ====== - First Steps ====== | ||
+ | |||
+ | Before to be used the QNet-SDK API Library need to be imported in the develop environment following next steps:\\ | ||
+ | |||
+ | - Open a new Visual Basic 2012 project called FirstSteps. | ||
+ | - Rename default form name from Form1 to DesktopView to be aligned with next following instructions. | ||
+ | - Import library using menu item " | ||
+ | - Open DesktopView code editor and add:\\ \\ | ||
+ | * Object reference declaration \\ To be used in the program the ClientNode01 interface need to be supported by an object reference with : \\ \\ <code freebasic> | ||
+ | ClientNode As QNetAccessLibrary01.ClientNode01</ | ||
+ | * Object creation \\ In some initialization place, like the main class constructor, | ||
+ | ' Create ClientNode object | ||
+ | ClientNode = New QNetAccessLibrary01.ClientNode01</ | ||
+ | * Release object \\ In some finalization place, like the main from closed event, release ClientNode01 object with : \\ \\ <code freebasic> | ||
+ | ' Free ClientNode object | ||
+ | ClientNode = Nothing</ | ||
+ | |||
+ | \\ | ||
+ | At the end of these steps you should have something like: \\ | ||
+ | <code freebasic> | ||
+ | Public Class DesktopView | ||
+ | |||
+ | Private ClientNode As QNetAccessLibrary01.ClientNode01 | ||
+ | |||
+ | Public Sub New() | ||
+ | |||
+ | ' This call is required by the designer | ||
+ | InitializeComponent() | ||
+ | |||
+ | ' Create and initialize ClientNode object | ||
+ | ClientNode = New QNetAccessLibrary01.ClientNode01 | ||
+ | |||
+ | End Sub | ||
+ | |||
+ | Private Sub DesktopView_FormClosed(sender As Object, e As FormClosedEventArgs) Handles MyBase.FormClosed | ||
+ | |||
+ | ' Free ClientNode object | ||
+ | ClientNode = Nothing | ||
+ | |||
+ | End Sub | ||
+ | |||
+ | End Class | ||
+ | </ | ||
+ | |||
+ | This is actually the minimal skeleton required to start to work with QNet-SDK.\\ | ||
+ | Next step involves to load Qmove project symbols files and operations required to read and write any type of Qmove variables. | ||
+ | |||
+ | |||
+ | ====== - Files ====== | ||
+ | |||
+ | <WRAP center round download 60%> | ||
+ | {{software: | ||
+ | </ |