Jump to content
C4 Forums | Control4

DriverWorks Serial Driver Issue


Max

Recommended Posts

I'm sure my problem is something simple and stupid that I'm doing but since the DriverWorks SDK documentation is a bit light in certain areas and this is only the 3rd driver I'm creating with it, I'm hoping someone has figured it out.

I'm creating a non-proxy, non-AV, serial based driver which means I can't use the one-way driver wizard and the serialcodemacros functionality. Not a big deal since DriverWorks includes the command C4:SendToSerial(idbinding, strData) or so I thought. Since I've been unsuccessfully messing with this for the last 24 hours I thought I would ask if anyone has played with this yet.

The device I'm sending commands to takes 3 byte hex commands, such as 40 01 31 (all being hex not decimal). I have verified the device works correctly by hooking it to a computer and doing serial commands that way. Once I attach it to the HC300 serial port and try to send commands via the C4:SendToSerial, I'm having a problem.

The documentation makes it look like it should be as simple as:

C4:SendToSerial("1","40 01 31")

I've also tried many other iterations like:

C4:SendToSerial("1","400131")

C4:SendToSerial("1",400131)

I'm not sure if the C4 function is expecting to send decimal or text vs. hex. I've also tried leaving the quotes off the bindingid. The serial port is properly setup under connections id 1 and I have specified the serial settings (4800 n 8 1 n) according to the documentation.

I would appreciate any help any of you could provide. I'm trying to get this driver done this week for an install.

Thanks.

Link to comment
Share on other sites


C4:SendToSerial(1, tohex("40 01 31"))

is what you're looking for.

The first parameter, the bindingID is a NUMBER, not a string, so don't put it in quotes. The second parameter, you want to send 3 hex values, not the ASCII value of "40 01 31". The 'tohex' helper function takes an ASCII string, and returns the hex that the ASCII string is representing.

Good luck on your driver.

RyanE

Link to comment
Share on other sites

  • 6 months later...

Hi

Can someone please help with this driver query

I need to send a serial command to serial port 1 on the HC 300

C4:SendToSerial(1, "LI1234")

When I look in the log file, I see

To /dev/c4serial/0: $4c$$49$$31$$32$$33$$34$

on Telnet I enter

<Ctrl C>LI1234<ENTER>

heart shape LI1234 press enter

and I get a valid respone

Thanks

Link to comment
Share on other sites

Congrats. Glad you're getting something working.

FYI, The 'H' in your tohex calls is not necessary.

tohex assumes that the values passed in the string are *hex* values.

C4:SendToSerial(1, tohex("03") .. "LI1234" .. tohex("0D"))

Should work the same.

RyanE

Link to comment
Share on other sites

  • 1 year later...

Director logs the serial port usage, dtserver does as well, I believe.

I've got a serial 'spy' driver that will also show activity sent / received through the spy driver, but I only make it available to dealers and Control4 partners. If you're a dealer, PM me on the dealer forums, and I'll get you a copy.

RyanE

Link to comment
Share on other sites

  • 8 months later...
  • 2 weeks later...

Hi

Please, I need some help

My DW driver stopped working some time ago.

I am trying desperately to get it working again.

I had it working since Mar-16-2009 12:53 PM.

This command worked :

C4:SendToSerial(1, tohex("03H") .. "LI1234" .. tohex("0DH"))

This is what I see in System Diagnostics when I send a command in debug mode, with no feedback from the 3rd application :

Aug 25 18:41:40 home-controller-300-000FFF10DE39 [1560]: To /dev/c4serial/0: $03$$4c$$49$$31$$32$$33$$34$$0d$

Hyperterminaling to the 3rd party device (Comfort Home Security - Cytech) works

I did a version test in DW and I get the following :

buildtime 11:27:17

builddate Dec 9 2009

version 1.7.4.36

buildtype

So I am guessing, since this date is after my last working version, something changed in my version update from 1.72 to 1.74.

If I do not get any assistance, I promise to send 10 posting each day and fill up this thread :lol:

Link to comment
Share on other sites

Hi

In the System diagnostic log I see To /dev/c4serial/0: $03$$4c$$49$$31$$32$$33$$34$$0d$

I want to connect the serial cable from C4 to my PC's serial port and send commands from the LUA command prompt in C4 to see if any data is being transmitted.

What software would you recommend to do this.

Thanks

Link to comment
Share on other sites

Hi

Thanks for all the help or lack of it.

Problem resolved. Faulty serial port on c4 control unit

Thanks

Sorry more people didn't have time to provide you with free technical support your majesty.

I know how future questions will be handled. Hopefully for you RyanE doesn't feel the same way.

Link to comment
Share on other sites

Hi

Yes thanks to you too.

Maybe you should look at the dates of the post before you comment, not that you offered any solutions to this thread.

Without support, C4 or any oher product is worthless. This forum is not about how clever and competent you are, it is about sharing the knowledge and growing the brand.

Iloveu2

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.