Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Writing Driver - Varying commands based on checksum
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?
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
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:


CheckSum is 11. I believe this is also called CheckSum8 Modulo 256
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

Possibly Related Threads…
Thread Author Replies Views Last Post
  Yamaha RX-V673 IP control Driver jdmevo123 22 8,429 03-27-2021, 03:02 PM
Last Post: Spot
  Updated SMS Driver gReatAutomation 0 178 01-28-2021, 12:53 PM
Last Post: gReatAutomation
  Sage Media Server driver (beta) Fonceur 698 301,299 07-26-2020, 04:59 PM
Last Post: sic0048
  RainMachine Sprinkler Irrigation Controller Driver kblagron 50 9,465 06-01-2020, 01:18 PM
Last Post: Dean Roddey
  Russound MCA-66 on TCP driver 5 1,375 05-24-2020, 06:23 AM
Last Post: gReatAutomation
  Samsung SmartTV Driver George M 0 433 05-20-2020, 09:04 AM
Last Post: George M
  OpenWeatherMap Weather Driver Using OneCall API kblagron 11 2,198 05-18-2020, 04:09 AM
Last Post: dlmorgan999
  Tesla Driver Driver kfly 10 2,784 05-08-2020, 08:49 AM
Last Post: gReatAutomation
  JVC D-ILA Driver jokermac 34 9,910 04-13-2020, 01:28 AM
Last Post: Mark Stega
  LIFX Driver bobskie708 15 8,514 01-05-2020, 11:00 AM
Last Post: simplextech

Forum Jump:

Users browsing this thread: 1 Guest(s)