beautypg.com

ClearOne Writing StreamNet User Manual

Page 49

background image

Control Driver Example

C-3

All specifications subject to change without notification. All rights reserved. Copyright © 2007 NetStreams

Main +1 512.977-9393 / fax +1 512.977.9398 / Toll Free Technical Support +1 866-353-3496

3600 W. Parmer Lane, Suite 100; Austin, TX 78727 /

www.netstreams.com.

-- consists of %XX where XX is two hexadecimal

characters. We

-- have to replace each escape with it's

corresponding single

-- character

--

if

(xmitString)

then

node.xmit = decodeString(xmitString)

end

-- set the newly created button up to handle the

#BUTTON command

function

node:handle_button(cmd)

--

-- we just handle #BUTTON PRESS by sending our

string

--

if

(cmd.params[1]:upper() ==

"PRESS"

and

self.xmit ~=

nil

)

then

g_serial:write(self.xmit)

-- Only change to the button set up

routine is to call

--

queryStatus after sending the text

to find out what

--

state the panamax is currently in

pollResponse()

end

end

-- set the label field in the status report

node:setStatus(

"label"

, Label)

-- assume an initial "off" state

node:setStatus(

"indicatorState"

,

"0"

)

end

-- function pollResponse()

-- Function that checks to see if there is anything

on the COM port

--

function

pollResponse()

-- read and parse the response