Sending Hex Codes

A plugin that allows for end user development of multiple RS232 device control systems.
deanb2
Senior Member
Senior Member
Posts: 181
Joined: Tue Feb 14, 2006 7:21 pm
Contact:

Postby deanb2 » Thu Jan 08, 2009 5:51 pm

Glad to see you have been working on this Fonceur, I had given up on MLGenericDevice ever supporting hex. I use Girder to setup a 2 way plugin for my Outlaw 990 pre/pro.

Anyway, can you add an option for a fixed length response? The Outlaw sends a 28 byte message in response to every command and user action, but it does not have a terminating character, as the last byte is a checksum.

All I need is to pass the 28 hex bytes off to a script, I think.

I tried used '83 45 <mask>' as the trigger, and it matches the response, but it doesn't wait for the whole 28 bytes.

Thanks, Dean

User avatar
Fonceur
Expert
Expert
Posts: 583
Joined: Sun Sep 09, 2007 10:18 am
Contact:

Postby Fonceur » Thu Jan 08, 2009 6:26 pm

deanb2 wrote:Anyway, can you add an option for a fixed length response? The Outlaw sends a 28 byte message in response to every command and user action, but it does not have a terminating character, as the last byte is a checksum.

Yes I should be able to do something like that. Currently I (try to) wait for the End character(s) and add up the rest of the buffer, but that obviously doesn't work for that. With all the commands the same number of bytes that does make it easier than a more generic approach.
MLComDevice: Control serial/TCP device (ASCII/hex) - MLSchedule: Alternative to MLScheduler
MLBeyondTV and MLSageTV: PVR support - TChanger: Sony BDP-CX7000ES 400 disc Bluray changer
TRadio: Sirius/HD/XM radio - TChart: Chart from variable Wiki

bigDvette
Expert
Expert
Posts: 718
Joined: Thu Oct 12, 2006 12:19 pm
Contact:

Postby bigDvette » Fri Jan 09, 2009 4:46 pm

I have the same problem with no terminator. Luckily my header has 2 fixed characters. My last 2 fields are checksum. So a fixed length response would be nice.

Even better would be the ability to use a header with no terminator. I have the possiblity of getting a 16 byte or 26 byte message, but they both begin with FF AA. Right now if you specify no terminator it doesn't work.

Lastly, I don't understand the checksum functions completely, but the checksum I need is 2 fields since my checksum is 4 digits. Anyway, I have to add up all the values from position 1 to 24 and the checksum goes in position 25 and 26.

User avatar
Fonceur
Expert
Expert
Posts: 583
Joined: Sun Sep 09, 2007 10:18 am
Contact:

Postby Fonceur » Fri Jan 09, 2009 5:25 pm

bigDvette wrote:I have the possiblity of getting a 16 byte or 26 byte message, but they both begin with FF AA.

Hmm, might be trickier... Though as long as they start by the same thing, I could probably use that to reconstruct them...

EDIT: I wonder if adding a 100 ms delay, before actually reading from the serial port, might ensure that everything has been received...

Lastly, I don't understand the checksum functions completely, but the checksum I need is 2 fields since my checksum is 4 digits. Anyway, I have to add up all the values from position 1 to 24 and the checksum goes in position 25 and 26.

If both are the same thing, you could try using SUM as checksum and end the commands by <CRC> <CRC>, I think it might work as is...
MLComDevice: Control serial/TCP device (ASCII/hex) - MLSchedule: Alternative to MLScheduler
MLBeyondTV and MLSageTV: PVR support - TChanger: Sony BDP-CX7000ES 400 disc Bluray changer
TRadio: Sirius/HD/XM radio - TChart: Chart from variable Wiki

deanb2
Senior Member
Senior Member
Posts: 181
Joined: Tue Feb 14, 2006 7:21 pm
Contact:

Postby deanb2 » Fri Jan 09, 2009 7:04 pm

bigDvette wrote:I have the possiblity of getting a 16 byte or 26 byte message, but they both begin with FF AA.

Is there a length byte in your message? Because that might be another way to handle it.

The Outlaw sends 83 45 <length> <data.....> <checksum>, but the length is always the same. So perhaps the trigger for this could be 83 45 <len> <mask>
But then you get into complications like does the length include the header and/or the length byte and/or the checksum. For the Outlaw, the length byte is the length of the data, not including the 2 byte header, the length byte, or the checksum byte. Harder to do in a generic way.

This is getting dangerously close to the stuff I do for a living...

Dean

User avatar
Fonceur
Expert
Expert
Posts: 583
Joined: Sun Sep 09, 2007 10:18 am
Contact:

Postby Fonceur » Fri Jan 09, 2009 7:30 pm

deanb2 wrote:Is there a length byte in your message? Because that might be another way to handle it.

Indeed, it would make sense and be easier to deal with. ;)

So perhaps the trigger for this could be 83 45 <len> <mask>
But then you get into complications like does the length include the header and/or the length byte and/or the checksum.

Well, worse case there could be <len>, <len2>, and so on, just as there are many checksum methods...

Anyway, version 0.2.7 is available, when a message is detected, it now waits 100 ms to actually read the buffer, so hopefully it can catch the whole string. I might make that delay configurable if it helps.
MLComDevice: Control serial/TCP device (ASCII/hex) - MLSchedule: Alternative to MLScheduler
MLBeyondTV and MLSageTV: PVR support - TChanger: Sony BDP-CX7000ES 400 disc Bluray changer
TRadio: Sirius/HD/XM radio - TChart: Chart from variable Wiki

deanb2
Senior Member
Senior Member
Posts: 181
Joined: Tue Feb 14, 2006 7:21 pm
Contact:

Postby deanb2 » Fri Jan 09, 2009 7:47 pm

Ok, the delay was enough to catch all of my bytes.

Thanks a lot

User avatar
Fonceur
Expert
Expert
Posts: 583
Joined: Sun Sep 09, 2007 10:18 am
Contact:

Postby Fonceur » Fri Jan 09, 2009 8:00 pm

deanb2 wrote:Ok, the delay was enough to catch all of my bytes.

Good! So I will make it configurable, so people can tweak it, to try to find the right value to catch all without having multiple messages together...
MLComDevice: Control serial/TCP device (ASCII/hex) - MLSchedule: Alternative to MLScheduler
MLBeyondTV and MLSageTV: PVR support - TChanger: Sony BDP-CX7000ES 400 disc Bluray changer
TRadio: Sirius/HD/XM radio - TChart: Chart from variable Wiki

User avatar
Fonceur
Expert
Expert
Posts: 583
Joined: Sun Sep 09, 2007 10:18 am
Contact:

Postby Fonceur » Sun Jan 11, 2009 1:48 pm

You might need to update your link (and some might be broken), as my plugin has been renamed from MLHexDevice to MLComDevice. The motivation being that it went from controlling serial hex devices, to serial/TCP ascii/hex devices...
MLComDevice: Control serial/TCP device (ASCII/hex) - MLSchedule: Alternative to MLScheduler
MLBeyondTV and MLSageTV: PVR support - TChanger: Sony BDP-CX7000ES 400 disc Bluray changer
TRadio: Sirius/HD/XM radio - TChart: Chart from variable Wiki

SRR
Newbie
Newbie
Posts: 14
Joined: Sat Jul 29, 2006 5:41 pm
Location: Minneapolis, MN
Contact:

Postby SRR » Sun Jan 11, 2009 9:33 pm

Fonceur - you have done an excellent job with this plug-in. Works perfectly for my Lexicon MC-12. Couple of wish list requests - you could 1) add the ability to delete commands and 2) add the capability to break up a long incoming string into multiple variables - that would be ideal so I could query the Lexicon's status (it returns multiple variables in one long string in response to one request) and instantly update all important variables in MLS. I'm going to work through this with scripts like others have but it would be great as an added feature.

Thanks!

Steve

User avatar
Fonceur
Expert
Expert
Posts: 583
Joined: Sun Sep 09, 2007 10:18 am
Contact:

Postby Fonceur » Sun Jan 11, 2009 10:04 pm

SRR wrote:1) add the ability to delete commands

Yes it is in the plans, I only added the context menu for the Devices list, but the others are coming.

2) add the capability to break up a long incoming string into multiple variables

For now you can do it through the mask and analyzing it yourself, but if you can give me some examples, I can see what I can do.
MLComDevice: Control serial/TCP device (ASCII/hex) - MLSchedule: Alternative to MLScheduler
MLBeyondTV and MLSageTV: PVR support - TChanger: Sony BDP-CX7000ES 400 disc Bluray changer
TRadio: Sirius/HD/XM radio - TChart: Chart from variable Wiki

MurrayW
Is there life beyond Cinemar?
Is there life beyond Cinemar?
Posts: 1198
Joined: Sun Mar 07, 2004 1:05 pm
Location: Austin, TX
Contact:

Postby MurrayW » Mon Jan 12, 2009 12:37 am

Fonceur wrote:You might need to update your link (and some might be broken), as my plugin has been renamed from MLHexDevice to MLComDevice. The motivation being that it went from controlling serial hex devices, to serial/TCP ascii/hex devices...
So will MLComDevice be able to do everything MLGenericDevice does from an ascii standpoint? Is this going to replace MLGenericDevice or will both plugins be available for a user to user to decide which one best fits his needs? Will MLComDevice support com ports > 16?

thanks,
Murray

User avatar
Fonceur
Expert
Expert
Posts: 583
Joined: Sun Sep 09, 2007 10:18 am
Contact:

Postby Fonceur » Mon Jan 12, 2009 1:36 am

MurrayW wrote:So will MLComDevice be able to do everything MLGenericDevice does from an ascii standpoint?

I am adding features based on request, and I tend to have a good track record... ;)

Is this going to replace MLGenericDevice or will both plugins be available for a user to user to decide which one best fits his needs?

Both have been developed independently and will keep existing as such. After seeing so many unanswered requests for control over hex serial device, I decided to give it a try and did the basic version in a weekend. Since then, I have been adding functionality based on users feedback. Once you have hex going, ASCII is pretty much done. Then the TCP control was basically a cut and paste from another of my plugins (MLSageTV)...

Will MLComDevice support com ports > 16?

With .NET Framework 2.0, MicroSoft added the SerialPort class which has the method SerialPort.GetPortNames(), which list every com ports on a system. That is what I use to build the list of choices... If they are not listed, then they most likely are not available to be used with that class in the first place...
MLComDevice: Control serial/TCP device (ASCII/hex) - MLSchedule: Alternative to MLScheduler
MLBeyondTV and MLSageTV: PVR support - TChanger: Sony BDP-CX7000ES 400 disc Bluray changer
TRadio: Sirius/HD/XM radio - TChart: Chart from variable Wiki


Return to “MLGenericDevice”

Who is online

Users browsing this forum: No registered users and 1 guest