Max Posted September 7, 2008 Share Posted September 7, 2008 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 More sharing options...
RyanE Posted September 8, 2008 Share Posted September 8, 2008 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 More sharing options...
RyanE Posted September 8, 2008 Share Posted September 8, 2008 Also, to see what your string is doing, use the 'hexdump' command.Compare the output in the Lua tab of the following:tst = "40 01 31"hexdump(tst)andtst = tohex("40 01 31")hexdump(tst)RyanE Link to comment Share on other sites More sharing options...
Reuben Posted March 15, 2009 Share Posted March 15, 2009 HiCan someone please help with this driver queryI need to send a serial command to serial port 1 on the HC 300C4: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 enterand I get a valid responeThanks Link to comment Share on other sites More sharing options...
RyanE Posted March 15, 2009 Share Posted March 15, 2009 You're not entering a Ctrl-C and a carriage return in your DriverWorks version.C4:SendToSerial(1, char(3) .. "LI1234" .. char(0x0d)) -- Might have to be 0x0a or 0x0a and then 0x0d...RyanE Link to comment Share on other sites More sharing options...
Reuben Posted March 15, 2009 Share Posted March 15, 2009 HI Ryan,Please take a look at the protocol.If I can send just one command successfully, I will be smokin.Thanks Link to comment Share on other sites More sharing options...
Reuben Posted March 16, 2009 Share Posted March 16, 2009 HiI figured it out C4:SendToSerial(1, tohex("03H") .. "LI1234" .. tohex("0DH"))Thanks Link to comment Share on other sites More sharing options...
RyanE Posted March 16, 2009 Share Posted March 16, 2009 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 More sharing options...
Reuben Posted November 16, 2010 Share Posted November 16, 2010 Hi,Is there a utility that can log/show all activities on the serial ports ?Thanks Link to comment Share on other sites More sharing options...
RyanE Posted November 16, 2010 Share Posted November 16, 2010 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 More sharing options...
Reuben Posted August 14, 2011 Share Posted August 14, 2011 HiHow do I test connectivity to C4 serial port using Hyperterminal ?Thanks Link to comment Share on other sites More sharing options...
Reuben Posted August 25, 2011 Share Posted August 25, 2011 HiPlease, I need some helpMy 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) worksI did a version test in DW and I get the following :buildtime 11:27:17builddate Dec 9 2009version 1.7.4.36buildtypeSo 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 Link to comment Share on other sites More sharing options...
RyanE Posted August 26, 2011 Share Posted August 26, 2011 tohex("0DH") and tohex("03H") are invalid.tohex does NOT require a trailing 'h' or 'H'. If you want to send a 0x0d as a character, either do tohex("0d") or string.char(0x0d).RyanE Link to comment Share on other sites More sharing options...
Reuben Posted August 26, 2011 Share Posted August 26, 2011 Hi Ryan,Thanks for the feedback.I will play with it tonight and report back promptly Link to comment Share on other sites More sharing options...
Reuben Posted August 26, 2011 Share Posted August 26, 2011 Nope, no change:( Link to comment Share on other sites More sharing options...
Reuben Posted August 27, 2011 Share Posted August 27, 2011 HiIn 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 More sharing options...
Reuben Posted August 28, 2011 Share Posted August 28, 2011 HiThanks for all the help or lack of it.Problem resolved. Faulty serial port on c4 control unitThanks Link to comment Share on other sites More sharing options...
ILoveC4 Posted August 28, 2011 Share Posted August 28, 2011 HiThanks for all the help or lack of it.Problem resolved. Faulty serial port on c4 control unitThanksSorry 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 More sharing options...
Reuben Posted August 30, 2011 Share Posted August 30, 2011 HiYes 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 More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.