When you need to receive a small group of data (variables) at high and fixed frequency from a connected device, the ideal solution is to program and play a real-time variable oscilloscope. This will send you required data at request frequency, if possible.
HINT: oscilloscope is used to get data from a minimum frequency of 100HZ up to a maximum of 1KHZ, where possible: for lower frequency, consider using a monitor instead.
Using an oscilloscope
In order to use an oscilloscope you have to perform the following steps:
1.Create the oscilloscope
2.Start the oscilloscope
3.Receive the data until desired or operation expired
4.Stop the oscilloscope
5.Destroy the oscilloscope
Each oscilloscope is identified by a couple of 32bit values, called owner ID and oscilloscope ID. You should assign a value to owner ID in order to distinguish you from other possible oscilloscope clients (use a pseudo random 32bit value): the oscilloscope ID is assigned by the connected device (don't make any assumption about the value of next ID).
First of all create your oscilloscope definition with bccOscCreate command: if successfully, it will give you the oscilloscope ID. When you are ready to receive data from oscilloscope, start it with the bccOscStart command, by indicating owner & oscilloscope ID and required data frequency (HZ): if successfully, the device will respond with the effective data frequency applied (not necessary what you required). If you don't agree with the data frequency, stop now the oscilloscope with bccOscStop command.
While receiving data, at applied frequency (or less if device is overloaded), you have to periodically grant data transmission (command bccOscWd) by indicating granted time in [ms]: the device will transmit data until this time is expired or a new grant replace the old one. This means that the device will sent data only if feel that client is connected and receive data, otherwise it will expire and stop the oscilloscope automatically.
Caution:
•If you give a grant time (for example) of 5000ms, be sure to transmit the new grant before that time (for example at 4500ms) otherwise you risk that the oscilloscope expire before new grant is acknowledged. If expired and yet valid, when you send a new bccOscWd, the oscilloscope is automatically restarted.
•If you create an oscilloscope and lost it, when you create an other oscilloscope (with same owner) and start it, if you use bccOscWd for all owner oscilloscope, you will restart the lost oscilloscope too. Then, Before create the new oscilloscope destroy all oscilloscope for that owner or check oscilloscope status with bccOscStatus.
Incoming data from the oscilloscope is carried by bccData message: see bccOscStart for more informations.
When you don't want more data from oscilloscope, or you don't receive data for a time (you can use the same grant time), you can stop the oscilloscope with the bccOscStop command. If oscilloscope is no more needed, can be destroyed with the bccOscDestroy command.
Each command you send for the oscilloscope (bccOscStart, bccOscStop, bccOscDestroy) always need the owner and oscilloscope ID: if these informations are not matched on the device, the operation will be denied.
Using multiple oscilloscopes
In the case you need multiple oscilloscope at one time (for example to use synchronized oscilloscopes), you can perform the following task (similar to single oscilloscope usage):
1.Create all oscilloscope definition and keep a list of all created oscilloscope ID
2.Start separately each oscilloscope (with oscilloscope ID) or start all oscilloscope of the owner (with special oscilloscope ID 0xFFFFFFFF).
3.Receive the data for all oscilloscopes until desired or operation expired: grant periodically the transmission separately for each oscilloscope (with oscilloscope ID) or grant all owner oscilloscope (with special oscilloscope ID 0xFFFFFFFF)
4.Stop separately each oscilloscope (with oscilloscope ID) or start all oscilloscope of the owner (with special oscilloscope ID 0xFFFFFFFF)
5.Destroy separately each oscilloscope (with oscilloscope ID) or start all oscilloscope of the owner (with special oscilloscope ID 0xFFFFFFFF).