beautypg.com

ClearOne Writing StreamNet User Manual

Page 58

background image

Writing StreamNet Device Drivers

D-6

All specifications subject to change without notification. All rights reserved. Copyright © 2005 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.

-- function WriteMessage(message)

-- Diego Alfarache

-- 09-20-2006

-- Decode string and write to the stream (serial port)

function WriteMessage(message)

debug("verbose", "Sending "..message)

-- call decodeString() to convert %XX to actual ASCII values

xmitMessage = decodeString(message)

serialPort:write(xmitMessage)

end

-- function handle_tune(command)

-- Diego Alfarache

-- 09-20-2006

-- Receive and process #TUNE commands

function handle_tune(command)

if( command == nil ) then

return

end

local AsciiMessage = ""

local dir = command.params[1]:upper()

if( dir == "DN" ) then

if( bIsV2 == true ) then

AsciiMessage = "W 1 6 4%0D"

else

AsciiMessage = "W 1 7 4%0D"

end

elseif( dir == "UP" ) then

if( bIsV2 == true ) then

AsciiMessage = "W 1 6 3%0D"

else

AsciiMessage = "W 1 7 3%0D"

end

else

-- look to see if the frequency has a dot in it. If it does, assume it

is FM