beautypg.com

ClearOne Writing StreamNet User Manual

Page 51

background image

Control Driver Example

C-5

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.

return

200

end

-- function queryStatus()

--

-- query the Panamax to see if anything has changed

--

function

queryStatus()

-- request the status so we know the initial state

of everything

g_serial:write(

"?OUTLETSTAT\r"

);

-- try again in a second if this is from a timer

return

10000

end

-- Now run the main code

-- Check to see if the COM port has been overridden

by Dealer Setup

if

( config ==

nil

)

then

config = {}

end

-- If the COM port doesn't exist, setup the default

if

( config.port ==

nil

)

then

config.port =

"comm://0;baud=9600;parity=none"

end

--

-- open the serial port and ready it for writing

--

g_serial = createStream(config.port)

if

(g_serial ==

nil

)

then

print(

"Unable to open stream \""..config.port.."

\

""

)

return

end

-- Create buttons

createButton(

"1"

,

"Power On"

,

"POWERON\r"

)