Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Writing Driver - Varying commands based on checksum
#1
I am writing a driver to support the Samsung Multiple Display Control (MDC) Protocol. This allows one to control Samsung TV's that use the MDC protocol for TV control either over RS232 or IP.

If you specify a TV ID (e.g., 00 - 255 as set up in your TV menu) in the command, you can send commands to specific TV's. This is useful if you have several TV's daisy chained together (e.g., ME Series). The other benefit of specifying a TV ID is that you will receive an Ack or Nak back from the TV in question. This is extremely helpful and useful in my opinion when doing many things.

If you have TV's daisy chained together and want to send the same command to every TV, you would specify 0xFE as the TV ID. In this case the command will execute for all TV's and you will not receive an Ack or Nak.

You can use TV ID of your TV or the TV ID of 0xFE interchangeably with the understanding that when you specify TV ID of 0xFE that you will not get back an Ack or Nak. For example, if you had 5 daisy chained TV's, you could send the power on command to all of them in one command (with TV ID of 0xFE) and then after that, check on the power or other status of TV ID 01, for example, which would then send you back an Ack or Nak. Note, you can still use TV ID of 0xFE even if you only have a single TV. The command will be sent but you will not receive an Ack or Nak.

The challenge is that specifying a TV ID (e.g., 01) will result in a CheckSum for the command while specifying a TV ID of 0xFE (send to all TV's) will result in a different checksum.  

For example, here is a HEX representation of Set Power ON/OFF command using TV ID of 01 and turning Power On. I've added bolded text for emphasis.

AA 11 01 01 01 14

and here is a HEX representation of Set Power ON/OFF command using TV ID of 0xFE (all TV's) and turning Power On:

AA 11 FE 01 01 11

What I want to be able to do with the driver is to ensure maximum flexibility and to minimize as much complication as possible.

My proposal is two fold (I have an Excel spreadsheet with the commands and that generates the CheckSums so this is really not an issue in terms of calculation):

1. Generate all commands with CheckSums for TV ID of 0xFE

2. General all commands with CheckSums for TV ID's in range of 00 to 99

These codes would then be put into the driver itself. When someone wanted to use the driver to send a command via the GC-100-06 they would have a couple of options:

a. send power on to all connected TV's (e.g., TV ID 0xFE)

b. send power on to TV ID 01

c. get power status of TV ID 99

Any thoughts or recommendations?
Reply
#2
Given how seldom the commands are sent, I wouldn't even bother. A single method to which you pass the basic command bytes, the target TV id, and possibly a couple other protocol housekeeping values if needed, could quickly generate the checksum and build up the outgoing message and send it. Then you could avoid a lot of complications at the cost of a wee bit of overhead. Unless these strings are super-long it won't be any particular burden to just build the messages on the fly.
Dean Roddey
Explorans limites defectum
Reply
#3
Thanks. So how, in a PDL driver, do you allow the user, when setting an Action in the IV, to specify a TV ID of 01-99 or 0xFE?

The CheckSum used is pretty easy and is the sum of all remainings. If it exceeds two digits discard the first number. That is, take the RIGHT 2 digits. For example:

11+FE+01+01=111

CheckSum is 11. I believe this is also called CheckSum8 Modulo 256
Reply
#4
It might have to be a CML driver to do the sort of thing I'm talking about. There is a checksum calculator expression in PDL though, that could do that sort of thing.
Dean Roddey
Explorans limites defectum
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  RunTimer2 driver rbroders 18 6,019 Yesterday, 04:38 PM
Last Post: rbroders
  Samsung HLxxA750 DLP Beta Driver jrunde 37 19,627 07-19-2019, 01:24 PM
Last Post: gReatAutomation
  Amazon Echo Hue Simulator Driver wuench 123 53,306 07-08-2019, 09:53 AM
Last Post: Dean Roddey
  New Driver - How hard would this be? kblagron 4 860 05-20-2019, 11:28 AM
Last Post: zaccari
  Cytech Comfort Driver znelbok 6 788 04-10-2019, 05:39 PM
Last Post: znelbok
  OpenHAB Driver whozeawhat 6 2,627 01-16-2019, 06:45 AM
Last Post: greymatter
  LIFX Driver bobskie708 14 4,373 01-10-2019, 06:36 PM
Last Post: Dean Roddey
  XBMC Driver wuench 428 190,924 12-28-2018, 11:07 AM
Last Post: dogman
  Driver for Bigass Fan lleo 7 1,191 11-25-2018, 08:57 AM
Last Post: Dean Roddey
  Generic Modbus Driver - Serial & IP znelbok 25 15,151 10-09-2018, 08:59 AM
Last Post: Ron Haley

Forum Jump:


Users browsing this thread: 1 Guest(s)