Utility class to send action command to GigE Vision devices. More...
Public Member Functions | |
PvActionCommand () | |
Constructor. | |
virtual | ~PvActionCommand () |
Destructor. | |
uint32_t | GetInterfaceCount () const |
Returns the number of network interfaces available on the system. More... | |
PvResult | GetInterfaceMACAddress (uint32_t aIndex, PvString &aInterfaceMACAddress) const |
Returns a string containing the MAC address of the network interface at aIndex. More... | |
PvResult | GetInterfaceIPAddress (uint32_t aIndex, PvString &aInterfaceIPAddress) const |
Returns a string containing the IP address of the network interface at aIndex. More... | |
PvResult | GetInterfaceDescription (uint32_t aIndex, PvString &aInterfaceDescription) const |
Returns a string containing the description of the network interface. This string is provided by the operating system. More... | |
PvResult | GetInterfaceEnabled (uint32_t aIndex, bool &aEnabled) const |
Gets whether action commands are sent or not on the network interface at aIndex. More... | |
PvResult | SetInterfaceEnabled (uint32_t aIndex, bool aEnabled) |
Enables or disables sending the action command on the network interface at aIndex. More... | |
uint32_t | GetDeviceKey () const |
Returns the current action command device key. More... | |
void | SetDeviceKey (uint32_t aDeviceKey) |
Sets the current action command group key. More... | |
uint32_t | GetGroupKey () const |
Returns the current action command group key. More... | |
void | SetGroupKey (uint32_t aGroupKey) |
Sets the current action command group key. More... | |
uint32_t | GetGroupMask () const |
Returns the current action command group mask. More... | |
void | SetGroupMask (uint32_t aGroupMask) |
Sets the current action command group mask. More... | |
bool | GetScheduledTimeEnable () const |
Returns the current state of the action command object scheduled time. More... | |
void | SetScheduledTimeEnable (bool aEnabled) |
Sets current action command object scheduled time. More... | |
uint64_t | GetScheduledTime () const |
Returns the current action command object scheduled time. More... | |
void | SetScheduledTime (uint64_t aScheduledTime) |
Sets the action command scheduled time. More... | |
PvResult | Send (uint32_t aTimeout, uint32_t aDeviceCount=0, bool aRequestAcknowledgements=true) |
Broadcasts the action command on all enabled network interfaces. More... | |
PvResult | Resend (uint32_t aTimeout, uint32_t aDeviceCount=0, bool aRequestAcknowledgements=true) |
Resends the action command using the same request ID. More... | |
uint32_t | GetAcknowledgementCount () const |
Returns how many acknowledgements have been received following the last Send. More... | |
PvResult | GetAcknowledgementIPAddress (uint32_t aIndex, PvString &aIPAddress) const |
Returns the IP address from which the acknowledgement at aIndex from the last Send was sent from. More... | |
PvResult | GetAcknowledgementStatus (uint32_t aIndex, PvActionAckStatusEnum &aStatus) const |
Returns the status of the acknowledgement at index aIndex for the last Send. More... | |
uint32_t | GetActionAckStatusOKCount () const |
Returns the count of status OK acknowledgements received since the object was created or the last time ResetStatistics was called. More... | |
uint32_t | GetActionAckStatusLateCount () const |
Returns the count of status OK acknowledgements received since the object was created or the last time ResetStatistics was called. More... | |
uint32_t | GetActionAckStatusOverflowCount () const |
Returns the count of status Overflow acknowledgements received since the object was created or the last time ResetStatistics was called. More... | |
uint32_t | GetActionAckStatusNoRefTimeCount () const |
Returns the count of status No Ref Time acknowledgements received since the object was created or the last time ResetStatistics was called. More... | |
void | ResetStatistics () |
Resets the statistics counters of the action command object. | |
Utility class to send action command to GigE Vision devices.
PvActionCommand add the ability of firing action commands defined using the GigE Vision action commands model.
To use a PvActionCommand, you instantiate an object from the class, configure the command to send, send the command and then optionally retrieve statistics about the outcome of the command. It is possible to use the same action command object to send more than one command: the same by calling Send over and over or different commands by changing its configuration between Send calls.
The eBUS SDK does not take charge of configuring action commands on the device directly. We assume that the GenICam interface of the device allows that and the user is either doing it manually with the GenICam browser in eBUS Player or programmatically in its own application.
uint32_t PvActionCommand::GetAcknowledgementCount | ( | ) | const |
PvResult PvActionCommand::GetAcknowledgementIPAddress | ( | uint32_t | aIndex, |
PvString & | aIPAddress | ||
) | const |
Returns the IP address from which the acknowledgement at aIndex from the last Send was sent from.
[in] | aIndex | Zero-based value up to GetAcknowledgementCount |
[out] | aIPAddress | The requested IP address. |
PvResult PvActionCommand::GetAcknowledgementStatus | ( | uint32_t | aIndex, |
PvActionAckStatusEnum & | aStatus | ||
) | const |
Returns the status of the acknowledgement at index aIndex for the last Send.
[in] | aIndex | Zero-based value up to GetAcknowledgementCount |
[out] | aStatus | The requested acknowledgement status. |
uint32_t PvActionCommand::GetActionAckStatusLateCount | ( | ) | const |
Returns the count of status OK acknowledgements received since the object was created or the last time ResetStatistics was called.
uint32_t PvActionCommand::GetActionAckStatusNoRefTimeCount | ( | ) | const |
Returns the count of status No Ref Time acknowledgements received since the object was created or the last time ResetStatistics was called.
uint32_t PvActionCommand::GetActionAckStatusOKCount | ( | ) | const |
Returns the count of status OK acknowledgements received since the object was created or the last time ResetStatistics was called.
uint32_t PvActionCommand::GetActionAckStatusOverflowCount | ( | ) | const |
Returns the count of status Overflow acknowledgements received since the object was created or the last time ResetStatistics was called.
uint32_t PvActionCommand::GetDeviceKey | ( | ) | const |
uint32_t PvActionCommand::GetGroupKey | ( | ) | const |
uint32_t PvActionCommand::GetGroupMask | ( | ) | const |
uint32_t PvActionCommand::GetInterfaceCount | ( | ) | const |
Returns the number of network interfaces available on the system.
Used to enumerate and enable/disable the network interfaces the action command is sent on.
PvResult PvActionCommand::GetInterfaceDescription | ( | uint32_t | aIndex, |
PvString & | aInterfaceDescription | ||
) | const |
Returns a string containing the description of the network interface. This string is provided by the operating system.
[in] | aIndex | Zero-based network interface index. See GetInterfaceCount. |
[out] | aInterfaceDescription | String containing the description of the network interface at aIndex. |
PvResult PvActionCommand::GetInterfaceEnabled | ( | uint32_t | aIndex, |
bool & | aEnabled | ||
) | const |
Gets whether action commands are sent or not on the network interface at aIndex.
[in] | aIndex | Zero-based network interface index. See GetInterfaceCount. |
[out] | aEnabled | Set to true if action commands are sent on that network interface. |
PvResult PvActionCommand::GetInterfaceIPAddress | ( | uint32_t | aIndex, |
PvString & | aInterfaceIPAddress | ||
) | const |
Returns a string containing the IP address of the network interface at aIndex.
[in] | aIndex | Zero-based network interface index. See GetInterfaceCount. |
[out] | aInterfaceIPAddress | String containing the IP address of the network interface at aIndex. |
PvResult PvActionCommand::GetInterfaceMACAddress | ( | uint32_t | aIndex, |
PvString & | aInterfaceMACAddress | ||
) | const |
Returns a string containing the MAC address of the network interface at aIndex.
[in] | aIndex | Zero-based network interface index. See GetInterfaceCount. |
[out] | aInterfaceMACAddress | String containing the MAC address of the network interface at aIndex. |
uint64_t PvActionCommand::GetScheduledTime | ( | ) | const |
Returns the current action command object scheduled time.
See SetScheduledTime
bool PvActionCommand::GetScheduledTimeEnable | ( | ) | const |
Returns the current state of the action command object scheduled time.
See SetScheduledTime
PvResult PvActionCommand::Resend | ( | uint32_t | aTimeout, |
uint32_t | aDeviceCount = 0 , |
||
bool | aRequestAcknowledgements = true |
||
) |
Resends the action command using the same request ID.
An application receiving an action command with the same request ID will acknowledge it but not execute the action if it was previously received.
Resends are not managed automatically as all application may have different requirements when it comes to resending actions. They need to be explicitly managed and performed if acknowledgements are missing.
See Send
[in] | aTimeout | Maximum time to wait for answers in ms. |
[in] | aDeviceCount | If different than zero, Send can return as soon as aDeviceCount acknowledgements have been received without having to wait for aTimeout. |
[in] | aRequestAcknowledgements | Asks the devices for acknowledgements of the action command. |
PvResult PvActionCommand::Send | ( | uint32_t | aTimeout, |
uint32_t | aDeviceCount = 0 , |
||
bool | aRequestAcknowledgements = true |
||
) |
Broadcasts the action command on all enabled network interfaces.
If more than one network interface is enabled, broadcasts are sent on each network interface (one after the other, in the order they were added to the action command object) and we then wait for up to aTimeout ms for acknowledgements on all these network interfaces.
When send is used, the request ID of the action command is automatically incremented. Use Resend to send the same action without incrementing the request ID.
The action command itself does not know how many devices are reached with this broadcast: all devices receiving the action command and configured to react to it (combination of device key, group key and group mask) are expected to perform the task associated with it.
See Resend
[in] | aTimeout | Maximum time to wait for answers in ms. |
[in] | aDeviceCount | If different than zero, Send can return as soon as aDeviceCount acknowledgements have been received without having to wait for aTimeout. |
[in] | aRequestAcknowledgements | Asks the devices for acknowledgements of the action command. |
void PvActionCommand::SetDeviceKey | ( | uint32_t | aDeviceKey | ) |
Sets the current action command group key.
The device key is a 32 bit value used to check the validity of action commands. Devices are only processing action commands if their device key matches the device key configured on the device - think of it as a secret password provided by action commands that must match the password configured on the device. The device key on the device would typically be configured using the GenICam interface of the device. The device key is defined at the device level.
See GetDeviceKey
[in] | aDeviceKey | Device Key. |
void PvActionCommand::SetGroupKey | ( | uint32_t | aGroupKey | ) |
Sets the current action command group key.
The group key defines a group of devices on which actions have to be executed. If a device supports action 1 with a group key of 0x24 and action 2 with a group key of 0x42 and an action command with group key of 0x24 is sent only action 1 is executed. The group key for actions of a device would typically be configured using the GenICam interface of the device. The group key is defined at the action level: different actions on a device can have a different group keys.
See GetGroupKey
[in] | aGroupKey | Group Key. |
void PvActionCommand::SetGroupMask | ( | uint32_t | aGroupMask | ) |
Sets the current action command group mask.
A group mask can be configured on an action command. This mask is applied by the device against the group mask of the action command and if the resulting value is non-zero the action is executed by the device. The group mask attribute allows defining groups and dynamically select a subset of devices to execute a specific command without having to alter the group key of the devices. The group mask for actions of a device would typically be configured using the GenICam interface of the device. The group mask is defined at the action level: different actions on a device can have different group masks.
See GetGroupKey
[in] | aGroupMask | Group Key. |
PvResult PvActionCommand::SetInterfaceEnabled | ( | uint32_t | aIndex, |
bool | aEnabled | ||
) |
Enables or disables sending the action command on the network interface at aIndex.
If a network interface is selected to send commands and it is not active (0.0.0.0 IP address) the command is not sent on the network but the operation does not fail either.
[in] | aIndex | Zero-based network interface index. See GetInterfaceCount. |
[in] | aEnabled | True to enable sending the action command on the network interface at aIndex, false to disable it. |
void PvActionCommand::SetScheduledTime | ( | uint64_t | aScheduledTime | ) |
Sets the action command scheduled time.
Action commands can either be performed on reception (no scheduled time enabled and provided) or they can be scheduled in the future. If a timestamp (device time domain) is provided the device queues the action command and performs the task associated to it as close to the scheduled action command timestamp as possible. If the device receives a timestamp set in the past relative to its time domain, it is expected to execute the command on reception. The queue the device uses to hold future actions may be limited. If a new command is received and the device is not able to add it to a full queue the sender is notified as long as acknowledgement of the action command has been requested.
The schedule time will only be used when the schedule time is enabled.
See GetScheduledTime SetScheduledTimeEnable
[in] | aScheduledTime | If set to zero, a regular (non-scheduled) action command will be issued. If different than zero, a GVCP scheduled action command with a 64 bit action_time of aScheduledTime will be issued. |
void PvActionCommand::SetScheduledTimeEnable | ( | bool | aEnabled | ) |
Sets current action command object scheduled time.
Action commands can either be performed on reception (no scheduled time enabled and provided) or they can be scheduled in the future. This function allow the control over the enabling state of the schedule action command.
[in] | aEnabled | true to use scheduled action command false to use action command and disregard the schedule time. |
Copyright (c) 2002-2021 Pleora Technologies Inc.
www.pleora.com