Looking For Serial Comms Protocol for Serial USB

First Arduino project. The application is a timing and scoring system for a electric race track. Arduino will capture all the timing activity and track power on/off events and communicate to and from the PC application software which will serve to display the results etc.

So I’m looking for an Arduino software library that is basically a serial communications handler for the Serial USB interface provided. (I think that’s pins 0 or 1). Comprised of a receive and transmit buffer.

My messages are varying lengths depending on the data that I’m sending. Each message has a 2 byte ID that will tell the firmware and PC software how to parse the message. In some cases I’m sending a long from the millis function plus an identifier that tells the application software on the PC what event the data has captured. In another case the message just contains a state of health or keep alive, if you will, that tells gives a status byte.

Anyone know of a serial handler that I could use or modify to do this? Trying to avoid writing one from scratch.

Do you mean on the PC side or on the Arduino side ?

What programming language / environment are you going to use on the PC side ?

Actually both but specifically I’m asking about the Arduino side. I’ve been looking at Firmata and I think I can make it work with some mods. I don’t like that the send routines reserves the 8th bit to signal a command per the MIDI spec. which means I have to piece the data back together on the receive side. I think I could just override the sendSysex() func to do what I want…

I’m doing the application in Visual C++ and an SDI formview. The comms side on the PC will be running in a background thread. As messages come in I will process them and update the main thread.

Any ideas you might have would be helpful.