com.esf.device.modem.channel.service
Interface IModemChannelService


public interface IModemChannelService

This interface defines a service to be used by modem plug-ins such as MC572x, MC87xx, and so on ...

Author:
ilya.binshtok

Field Summary
static java.lang.String SERVICE_NAME
          service name of this interface for the bundle activator (com.esf.device.modem.channel.service.IModemChannelService)
 
Method Summary
 void close(java.lang.String port)
          Closes modem channel
 java.lang.Class getOwner(java.lang.String port)
          Reports the owner of supplied serial port
 boolean isFunctional(int channelType, java.lang.String port, int baud, int dataBits, int stopBits, int parity)
          Reports if modem is functional that is if it replies to AT commands.
 boolean isFunctional(java.lang.String port)
          Reports if modem is functional that is if it replies to AT commands.
 boolean isOpened(java.lang.String port)
          Reports if modem is opened
 void open(java.lang.String port, int channelType, java.lang.Class channelOwner, int baud, int dataBits, int stopBits, int parity)
          Opens modem channel
 ModemReply sendCommand(java.lang.String port, java.lang.Class channelOwner, int baud, int dataBits, int stopBits, int parity, ModemCommand command, int tout)
          This method opens specified modem channel, sends modem command, obtains reply and closes the channel.
 ModemReply sendCommand(java.lang.String port, ModemCommand command, int tout)
          This method sends modem command to specified open port and obtains reply.
 

Field Detail

SERVICE_NAME

public static final java.lang.String SERVICE_NAME
service name of this interface for the bundle activator (com.esf.device.modem.channel.service.IModemChannelService)

Method Detail

open

public void open(java.lang.String port,
                 int channelType,
                 java.lang.Class channelOwner,
                 int baud,
                 int dataBits,
                 int stopBits,
                 int parity)
          throws java.lang.Exception
Opens modem channel

Parameters:
port - - serial port
channelType - - channel type (e.g. AT or HIP)
channelOwner - - channel owner class
baud - - baud rate
dataBits - - number of data bits
stopBits - - number of stop bits
parity - - parity (e.g. none, even, odd)
Throws:
java.lang.Exception - if there is an error opening

close

public void close(java.lang.String port)
           throws java.lang.Exception
Closes modem channel

Parameters:
port - - serial port
Throws:
java.lang.Exception - if there is an error closing

isOpened

public boolean isOpened(java.lang.String port)
Reports if modem is opened

Parameters:
port - - serial port
Returns:
boolean
true - modem device is opened
false - modem device is not opened

isFunctional

public boolean isFunctional(java.lang.String port)
Reports if modem is functional that is if it replies to AT commands.

Parameters:
port - - serial port
Returns:
boolean
true - modem is functional
false - modem is not functional

isFunctional

public boolean isFunctional(int channelType,
                            java.lang.String port,
                            int baud,
                            int dataBits,
                            int stopBits,
                            int parity)
Reports if modem is functional that is if it replies to AT commands.

Parameters:
channelType - - channel type
port - - serial port
baud - - baud rate
dataBits - - number of data bits
stopBits - - number of stop bits
parity - - parity
Returns:
boolean
true - modem is functional
false - modem is not functional

sendCommand

public ModemReply sendCommand(java.lang.String port,
                              ModemCommand command,
                              int tout)
                       throws java.lang.Exception
This method sends modem command to specified open port and obtains reply. Modem port remains open on return.

Parameters:
port - - serial port
command - - modem command
tout - - timeout in milliseconds
Returns:
ModemReply object
Throws:
java.lang.Exception - if there is an error in sending or receiving

sendCommand

public ModemReply sendCommand(java.lang.String port,
                              java.lang.Class channelOwner,
                              int baud,
                              int dataBits,
                              int stopBits,
                              int parity,
                              ModemCommand command,
                              int tout)
                       throws java.lang.Exception
This method opens specified modem channel, sends modem command, obtains reply and closes the channel.

Parameters:
port - - serial port
channelOwner - - class that owns the channel
baud - - baud rate
dataBits - - number of data bits
stopBits - - number of stop bits
parity - - parity
command - - modem command
tout - - timeout in milliseconds
Returns:
ModemReply object
Throws:
java.lang.Exception - if there is an error in sending or receiving

getOwner

public java.lang.Class getOwner(java.lang.String port)
Reports the owner of supplied serial port

Parameters:
port - - serial port
Returns:
Class that owns the port, null if port is not opened


Copyright © 2009 Eurotech Inc. All rights reserved.