4.2.1 Command Line Client |
The C:\Program Files\RAYLASE\ProcessDataAnalyzer\API\SampleCode\SampleApplications\CommandLineClient can be used to test the 3.2.1 Service/Server/Client API connection, for manual command line interference with a running setup or for small batch script automations.
This sections aims to give you an idea how to use the RAYLASE.PDA.CommandLineClient.exe. For a list of all available commands in your current RAYLASE.PDA.CommandLineClient.exe version, type:
RAYLASE.PDA.CommandLineClient.exe --help
It is also possible to get help on a specific command for its parameters, e.g.:
RAYLASE.PDA.CommandLineClient.exe export --help
To use the RAYLASE.PDA.CommandLineClient.exe, first make sure that an instance of the ProcessDataAnalyzer.Service.exe is running. Otherwise, the client will have no endpoint to connect to.
First we will have to connect a card. Please note that the service can be running in the background indefinitely, so once a card is connected and not explicitly disconnected, it will stay connected to the service as long as the service is running.
Below we will connect a card by IP address. If you are not sure which IP address belongs to the card you want to connect to, it is also possible to connect by serial number.
Notice: By connecting a device by serial number, the service will need to perform a discovery first. This is done once for the current session or if the specified serial number is not found in the session cache.
Rem If unsure, get some information on the connect command RAYLASE.PDA.CommandLineClient.exe connect --help Rem Connect to a card by IP address RAYLASE.PDA.CommandLineClient.exe connect 10.2.0.7
If no connection target is specified, the service will try to connect to the last used device.
Now we can start the acquisition on the connected card. If no card is specified with the acquisition command, all connected cards will start the acquisition simultaneously.
The card's configuration will be the last used configuration of the PDA UI or service. In this example we want to acquire data for five seconds and we want the command line to return after the acquisition is done.
Rem Start a 5 s acquisition with a blocking call on all connected cards RAYLASE.PDA.CommandLineClient.exe start --autoStopSeconds 5 --waitForStop
It will take roughly five seconds after hitting enter for the command line to return. The acquisition time sets the actual card acquisition run time. This ignores the logic overhead implied by the command line tool and the server/client connection and its processing.
Now that we have successfully acquired some data, we can export them. The exported data can be used in a variety of use cases.
If the trace files are saved, they can be loaded for inspection into the PDA UI.
Rem Save trace files RAYLASE.PDA.CommandLineClient.exe save --path "C:\traces.zip"
If the traces are exported, they can be used in Excel or other post-processing programs. The file ending determines the exported file type. A distinction between .csv and .txt is made.
Rem Save trace files RAYLASE.PDA.CommandLineClient.exe export --path "C:\export.csv"
Depending on your use cases it might make sense to disconnect the card from the service when it is not needed any more. This can enable the card to connect to a different application, depending on the card's connection restrictions.
Rem Disconnect all connected cards RAYLASE.PDA.CommandLineClient.exe disconnect
The currently used PDA configuration of the service can be saved to a .json file.
Rem Saves the current service PDA configuration to .json RAYLASE.PDA.CommandLineClient.exe savePdaConfiguration --path "C:\CurrentConfigurations.json"
Unlike the PDA API, the Command Line Client does not supply a fine grained configuration of each card's signals. It offers the functionality to load an existing Configurations.json though. The Configurations.json needs to include a configuration for each connected device, uniquely identified by the ConnectionId, see 3.2.3 Card Connection.
Rem Load a configurations file from path RAYLASE.PDA.CommandLineClient.exe setPdaConfig --path "C:\CurrentConfigurations.json"
It is possible to get a list of connected cards to ensure the connection order and number of connections is as expected.
Rem List all connected cards RAYLASE.PDA.CommandLineClient.exe getConnectedCards