Skip to main content

diagGetAssignedTargetGroups

Valid for: CANoe DE

Function Syntax

long DiagGetAssignedTargetGroups(DiagRequest request, dword& targetGroupFlagsOut);
long DiagGetAssignedTargetGroups(DiagResponse response, dword& targetGroupFlagsOut);

Description

Returns a bitmask where each bit represents a target group. The diagnostic description defines in which target group the object may be sent, and the bit for this group is set to 1 in the mask returned. The position of the bit in the mask (0 for least significant bit) can be used to query the qualifier and name of the target group using DiagGetTargetGroupQualifier and DiagGetTargetGroupName.

Parameters

  • request: Diagnostic request.
  • response: Diagnostic response.
  • targetGroupFlagsOut: Receives the bitmask for the target groups.

Return Values

Error code

Example

void PrintAssignedTargetGroups(diagRequest * req)
{
  dword flags;
  long status;
  dword groupNo;
  char targetGroupQualifier[100];

  // Retrieve the target groups the request may be sent in
  flags = 0;
  status = DiagGetAssignedTargetGroups( req, flags);

  // Convert bitmask to target group qualifier and name for write window
  groupNo = 0;
  while( 0 <= DiagGetTargetGroupQualifier(groupNo, targetGroupQualifier))
  {
    char targetGroupName[100];
    DiagGetTargetGroupName(groupNo, targetGroupName);
    if( flags & (1 << groupNo))
      write( "%d. %s \"%s\": on", groupNo, targetGroupQualifier, targetGroupName);
    else
      write( "%d. %s \"%s\": off", groupNo, targetGroupQualifier, targetGroupName);
    ++groupNo;
  }
}
DiagGetTargetGroupQualifierDiagGetTargetGroupName