Promixis, LLC Forums  

Go Back   Promixis, LLC Forums > Girder > Girder Developer

Reply
 
Thread Tools Display Modes
  #1  
Old March 23rd, 2010, 02:01 AM
Tieske8 Tieske8 is offline
Member
Experienced User
 
Join Date: Jul 2007
Location: Netherlands
Posts: 75
Default Serial device development; getting 'self' in a callback

Currently developing a serial driver using the queued serial object.

The callback methods for receiving data, do not include the 'self' parameter. Now if I want to set some values on the object, based upon the received answer, I need access to 'self' (not?).

How to go about getting a reference to 'self' in this case? or is there another (preferred) way of achieving this?

any help is greatly appreciated
__________________
Using: WinXP MCE, Girder, xPL, X10, HomeEasy

http://www.thijsschreijer.nl
Reply With Quote
  #2  
Old March 23rd, 2010, 09:11 AM
Rob H's Avatar
Rob H Rob H is offline
Senior Member
Promixis Team
 
Join Date: May 2004
Location: Cardigan, UK
Posts: 9,278
Default

You shouldn't be using callbacks, that will interfere with the normal operation of the serial device.

Just override the ReceiveResponse method but be sure to call the inherited method from within it.

Having said all that the serial classes are really deprecated these days in Girder 5, it's generally better to implement your device using the transport classes if you can. If you're using Girder 4 then you're stuck with the serial classes though.
__________________
--Rob
Reply With Quote
  #3  
Old March 23rd, 2010, 12:35 PM
Tieske8 Tieske8 is offline
Member
Experienced User
 
Join Date: Jul 2007
Location: Netherlands
Posts: 75
Default

Hi Rob,

thx for the feedback. I've searched the help files on the transport stuff but couldn't find anything (as opposed to the serial stuff). Seems to me the documentation is really outdated? (has it even changed since Girder 4?)

any way; can you point me to some documentation or examples on creating drivers for a serial connected device using the transport stuff?

thx!
__________________
Using: WinXP MCE, Girder, xPL, X10, HomeEasy

http://www.thijsschreijer.nl
Reply With Quote
  #4  
Old March 25th, 2010, 01:20 AM
Tieske8 Tieske8 is offline
Member
Experienced User
 
Join Date: Jul 2007
Location: Netherlands
Posts: 75
Default

Just found the documentation, after checking the site, the manual was an updated one. I was still running one of the early Girder 5 versions. Installed the newer version and all docs are there.
__________________
Using: WinXP MCE, Girder, xPL, X10, HomeEasy

http://www.thijsschreijer.nl
Reply With Quote
  #5  
Old March 25th, 2010, 04:54 PM
Tieske8 Tieske8 is offline
Member
Experienced User
 
Join Date: Jul 2007
Location: Netherlands
Posts: 75
Question

Quote:
Originally Posted by Rob H View Post
You shouldn't be using callbacks, that will interfere with the normal operation of the serial device.

Just override the ReceiveResponse method but be sure to call the inherited method from within it.
I'm sticking to the serial device for now, using the queued object. Checked the help files on this;
Quote:
Queued Sending
If the device driver object is based on serial.Classes.Queued rather than serial.Classes.Simple, then a more advanced version of SendCommand is available. This stores messages and response functions on a queue. Behind the scenes, the command is sent and when a response arrives the response function is called. Then the next command is sent and so on. It is not necessary to provide a ReceiveResponse replacement.
It explicitly states that no override of "ReceiveResponse" is required, as opposed to your statement. What's the caveat?

The original question stays; how to get a reference to 'self' inside the callback method provided to the 'SendCommand'?
__________________
Using: WinXP MCE, Girder, xPL, X10, HomeEasy

http://www.thijsschreijer.nl
Reply With Quote
  #6  
Old April 9th, 2010, 02:35 PM
Rob H's Avatar
Rob H Rob H is offline
Senior Member
Promixis Team
 
Join Date: May 2004
Location: Cardigan, UK
Posts: 9,278
Default

ReceiveResponse override isn't required, but it is still the recommended way of handling responses.

As I said, do not use callbacks with the serial classes, it will break the operation of the serial device.
__________________
--Rob
Reply With Quote
Reply

Tags
lua, serial

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -6. The time now is 08:36 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Copyright (c) Promixis, LLC