Skip to content
DataMiner DoJo

More results...

Generic selectors
Exact matches only
Search in title
Search in content
Post Type Selectors
Search in posts
Search in pages
Search in posts
Search in pages
Log in
Menu
  • Updates & Insights
  • Questions
  • Learning
    • E-learning Courses
    • Empower Replay: Limited Edition
    • Tutorials
    • Open Classroom Training
    • Certification
      • DataMiner Fundamentals
      • DataMiner Configurator
      • DataMiner Automation
      • Scripts & Connectors Developer: HTTP Basics
      • Scripts & Connectors Developer: SNMP Basics
      • Visual Overview – Level 1
      • Verify a certificate
    • Video Library
    • Books We Like
    • >> Go to DataMiner Docs
  • Expert Center
    • Solutions & Use Cases
      • Solutions
      • Use Case Library
    • Markets & Industries
      • Media production
      • Government & defense
      • Content distribution
      • Service providers
      • Partners
      • OSS/BSS
    • Agile
      • Agile Webspace
      • Everything Agile
        • The Agile Manifesto
        • Best Practices
        • Retro Recipes
      • Methodologies
        • The Scrum Framework
        • Kanban
        • Extreme Programming
      • Roles
        • The Product Owner
        • The Agile Coach
        • The Quality & UX Coach (QX)
    • DataMiner DevOps Professional Program
      • About the DevOps Program
      • DataMiner DevOps Support
  • Downloads
  • More
    • DataMiner Releases & Updates
    • Feature Suggestions
    • Climb the leaderboard!
    • Swag Shop
    • Contact
    • Global Feedback Survey
  • PARTNERS
    • All Partners
    • Technology Partners
    • Strategic Partner Program
    • Deal Registration
  • >> Go to dataminer.services

How to store and present binary value in a parameter or get the binary value in QAction C# code

Solved955 views11th July 2023binary Parameters serial
1
Pengf Hu23 18th November 2022 0 Comments

Hi

I am writing a serial protocol driver sends a command and receive a response from a TCP server.

Seems the driver can send and receive the packet to/from the TCP server. I can see the transactions from the element Stream Viewer.

Looks like I can receive the binary value (it is a fixed length binary value) from the TCP socket.

But I don’t know how to present this binary value in a parameter (as a string or hex format, e.g. “0000000000050a0302804e”) in the xml protocol driver.

I have parameter 7 to store the received binary value and It’s always empty:

Following is the parameter 7 xml tags:

<Param id=”7″ trending=”false”>
<Name>RESPONSE</Name>
<Description>RESPONSE</Description>
<Information>
<Includes>
<Include>range</Include>
<Include>units</Include>
<Include>steps</Include>
<Include>time</Include>
</Includes>
</Information>
<Type>response</Type>
<Interprete>
<RawType>numeric text</RawType>
<Type>string</Type>
<LengthType>next param</LengthType>
</Interprete>
<Display>
<RTDisplay>true</RTDisplay>
<Positions>
<Position>
<Page>General</Page>
<Column>0</Column>
<Row>2</Row>
</Position>
</Positions>
</Display>
</Param>

I also try to use the QAction C# code to get the content of param 7 and the returned value seems empty as well.

respS = Convert.ToString(protocol.GetParameter(7));
protocol.Log(respS);

Please help, thanks.

Marieke Goethals [SLC] [DevOps Catalyst] Selected answer as best 11th July 2023

1 Answer

  • Active
  • Voted
  • Newest
  • Oldest
3
Tom Waterbley [SLC] [DevOps Catalyst]8.89K Posted 18th November 2022 0 Comments

The protocol.GetParameter() method call returns the value as string, but stops at the first zero byte (0x00).

The following method can be used to retrieve the raw bytes that were received:

public static byte[] GetParameterBinary(this SLProtocol protocol, int parameterId)
{
var data = (object[])protocol.GetData(“parameter”, parameterId);
return data?.Cast<byte>().ToArray();
}

Usage:

byte[] data = protocol.GetParameterBinary(7);

Marieke Goethals [SLC] [DevOps Catalyst] Selected answer as best 11th July 2023
Please login to be able to comment or post an answer.

My DevOps rank

DevOps Members get more insights on their profile page.

My user earnings

0 Dojo credits

Spend your credits in our swag shop.

0 Reputation points

Boost your reputation, climb the leaderboard.

Promo banner DataMiner DevOps Professiona Program
DataMiner Integration Studio (DIS)
Empower Katas
Privacy Policy • Terms & Conditions • Contact

© 2025 Skyline Communications. All rights reserved.

DOJO Q&A widget

Can't find what you need?

? Explore the Q&A DataMiner Docs