Skip to content

Get instance handle from Sample Info (CON-346) #121

Description

@jcass8695

Hello, I am X-posting this issue from the Go Connector repo for better visibility, I will paste the details from that issue here.

Proposal:

Hello 👋🏻 I would like to be able to get the instance_handle field from the Sample Info structure (called Infos in this library). I have tried forking the library and adding a simple method that replicates what already exists, you can view it here: rticommunity/rticonnextdds-connector-go#59

Current behavior:

Unfortunately calling this method results in the following error in our Go code:

err = m.reader.Take()
if err != nil && !errors.Is(err, rti.ErrNoData) {
	return fmt.Errorf("taking samples from input: %w", err)
}

l, err := m.reader.Samples.GetLength()
if err != nil {
	return fmt.Errorf("taking samples from input: %w", err)
}

for i := range l {
        instanceHandle, err := m.reader.Infos.GetInstanceHandle(i)
        if err != nil {
	        return fmt.Errorf("getting instance handle from sample: %w", err)
        }
        ...
}
getting instance handle from sample: DDS Exception: 
 RTILuaSampleInfo_get:Unknown SampleInfo field: instance_handle
  RTILuaMetamethodImpl_InDataDereference:!RTILuaSampleInfo_get failed with retcode  1
   RTILuaMetamethodImpl_InData:!dereference operation failed with retcode  1
    RTI_Connector_get_json_from_infos:!get stack values

Desired behavior:

The instance handle is returned.

Use case:

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions