Sending Command in Hex to device using client.print()

Im working with an OBD2 datalogger, and am trying to push commands to it to retrieve vehicle data.

I want to, or am using client.write() function in the Yun client class to do this. However, I guess Im having trouble thinking this out or am overthinking it.

Basically, the OBD2 Datalogger commands are made of Hex characters written in ASCII characters. So suppose i want to send 010C.

So I implemented it as client.write(010C), and im under the impression that write() will send it as a series of bytes which I assume will not work. So my best bet is to convert the code to decimal equivalent or will the write function break it down into bytes.

my understanding however is that the Logger needs the code to be sent in Hex represented by ASCII characters, and as such write doesn't seem to get me anything. Would Print() be a better solution?

Im just confused as to the interpretation and subsequent implementation method when having to send Hex character commands written in ASCII characters.

Here is my little bit of code so far:

#include <Bridge.h>
#include <YunClient.h>

#define PORT 35000

// Define the Client Object
YunClient client;
void setup()
{
  // Bridge Setup to Linux Processor
  Bridge.begin();
  
  Serial.begin(9600);
  
  // Wait for Serial Connection
  while(!Serial); 
}

void loop() 
{
  // Define the IP address of Logger (192.168.0.10)
  IPAddress addr(192, 168, 0, 10);
  
  // Connect to OBD2 Wifi
  client.connect(addr, PORT);
  if (client.connected())
  {
    Serial.println("Connected to the Device.");
    
    // Send ASCII based HEX code to OBD2
    client.print(O10c);

    // give the server time to respond.
    delay (250);
  
    // Read all incoming bytes available from the server and print them
    while (client.available())
    {
      char c = client.read();
      Serial.print(c);
    }
    Serial.flush();

    // Close the connection
    client.stop();
  }
  else
    Serial.println("Could not connect to the server.");  
    
  // Give some time before trying again
  delay (10000);
}
// Push AT commands to OBD2 to Configure
// Extract Information from Logger

So I implemented it as client.write(010C), and im under the impression that write() will send it as a series of bytes which I assume will not work.

write() will send the data as a series of bytes. However 010C is NOT a valid value. An octal constant can NOT have a C in it. It's an octal constant because it starts with a 0.

byte crapToSend[] = {0x01, 0x0C};
client.write(crapToSend, 2);

Ah thank you. I knew that I couldn't enter that value as is, but wasnt quite sure how to handle it. Thanks.