beautypg.com

ClearOne Writing StreamNet User Manual

Page 54

background image

Writing StreamNet Device Drivers

D-2

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.

--

Get and Process Input from Serial Port

-- function PerformReset()

--

Perform a soft reset of the zTuner when we seem to have lost

communications

-- function QueryStatus()

--

Periodically query for the frequency of the tuner. This is more

important with V1 tuners that have no unsolicited messages

-- function RefreshFrequency()

--

Send command to get the frequency from tuner

-- function RequestV2Status()

--

Send command to refresh the V2 tuner's status info

-- function SendPower(bOn)

--

Send command to power the tuner on (or off)

-- function WriteMessage(message)

--

Decode and send commands to the tuner

-- uncomment the next line for any hope of debugging startup issues

-- setDebug("all", "on")

setDebug("error", "on")

debug("Driver loading")

-- setup our constants

IDLE = 0

FREQUENCY_FIRST = 1

FREQUENCY_LAST = 2

BAND = 3

POWER_STATE = 4

FM = 0

AM = 1

BANDNAME = {

[FM] = "FM ",

[AM] = "AM "

}

-- setup our module variables

serialPort = nil

bIsV2 = false;

szFreq = "---.-"

nResponseTimeout = 0

nExpectedRX = IDLE

nRefreshPowerTimeout = 5

nRefreshFreqTimeout = 0

nTimeouts = 0

nBand = FM

szInput = ""

szPwrOn = "0"

-- We have to create our functions first then we can use them below