beautypg.com

Handle_command(command), Anode = getsubnode(strnodename) – ClearOne Writing StreamNet User Manual

Page 32

background image

Writing StreamNet Device Drivers

9-2

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.

NOTE

Strictly speaking, this function need never be defined or used since any command will
first be handled by the type specific handler.

It is always possible to
define an appropriate
command-specific
handler, so that the
default_command_hand
ler is not needed.
Programming best-
practices state that a
fallback
default_command_hand
ler should be defined
even if it is not intended
for use.

The single argument is an AsciiCommand table as documented in Chapter 2,

Handling

Commands

on page 3-1. The driver can define a handle_command method to handle

the incoming ASCII command “#command …”. The driver can define a
handle_command method to handle the incoming ASCII command “#command
…”command method to handle the incoming ASCII command “#command …”

The single argument is an AsciiCommand table as documented in Chapter 2,

Handling

Commands

on page 3-1.

For more information on command handling see Chapter 2,

Handling Commands

on

page 3-1.

handle_command(command)

The driver can define a handle_command method to handle the incoming ASCII
command “#command …”

The single argument is an AsciiCommand table as documented in The driver can
define a handle_command method to handle the incoming ASCII command
“#command …”. The driver can define a handle_command method to handle the
incoming ASCII command “#command …”_command method to handle the incoming
ASCII command “#command …”

The single argument is an AsciiCommand table as documented in Chapter 2,

Handling

Commands

on page 3-1.

aNode = getSubNode(strNodeName)

Returns the node associated with strNodeName by fetching subNodes[strNodeName].

Device drivers may replace this routine with one of their own if they wish to create
nodes on the fly as they are addressed by commands. Such an implementation might
look like:

function getSubNode(strNodeName)

if(subNodes[strNodeName] == nil) then

node = createSubNode(strNodeName)

… do some more initialization here

else

node = subNodes[strNodeName]

end

return node

end