Loading...
Searching...
No Matches
SerialPort.idl
/* SPDX-License-Identifier: BSD-3-Clause */
/*
* Copyright 2011 Raritan Inc. All rights reserved.
*/
#include <GsmModem.idl>
#include <AnalogModem.idl>
/** Serial Ports */
module serial {
/**
* Interface describing a physical serial port
* and the devices which can be attached to it
*/
interface SerialPort {
/**
* Error codes
*/
constant int SUCCESS = 0; ///< No error
constant int ERR_INVALID_VALUE = 1; ///< Invalid arguments
/**
* Possible states the port can be in at a given time
*/
enumeration PortState {
CONSOLE, ///< The console application is running on the port
ANALOGMODEM, ///< An analog modem is attached to the port
GSMMODEM, ///< A GSM modem is attached to the port
DISCONNECTED ///< No device matching the configured mode is detected
};
/**
* Device type the port shall be looking for
*/
enumeration DetectionType {
AUTOMATIC, ///< Try to automatically determine the connected device
FORCE_CONSOLE, ///< Always assume a console (terminal) is connected
FORCE_ANALOGMODEM, ///< Always assume an analog modem is connected
FORCE_GSMMODEM ///< Always assume a GSM modem is connected
};
/**
* Possible baud rates
*/
enumeration BaudRate {
BR1200, ///< 1.200 kbit/s
BR2400, ///< 2.400 kbit/s
BR4800, ///< 4.800 kbit/s
BR9600, ///< 9.600 kbit/s
BR19200, ///< 19.200 kbit/s
BR38400, ///< 38.400 kbit/s
BR57600, ///< 57.600 kbit/s
BR115200 ///< 115.200 kbit/s
};
/**
* (Static) meta data containing port properties
*/
structure MetaData {
boolean hasModemSupport; ///< Whether or not the port can detect modems (if false,
///< this port can only operate in console mode)
};
/**
* Structure holding information about
* the current state of the port
*/
structure State {
PortState state; ///< Current connection state
string deviceName; ///< Name of the device currently connected
};
/**
* Port settings
*/
structure Settings {
BaudRate consoleBaudRate; ///< Baud rate to be used for running the console application
BaudRate modemBaudRate; ///< Baud rate to be used for communicating with an attached modem
DetectionType detectType; ///< Type of connected device to be assumed in device detection
};
/**
* Event emitted when the modem connection state changes
*/
valueobject ModemEvent extends idl.Event {
Object modem; ///< Either a {@link AnalogModem} or a {@link GsmModem}
};
/**
* Event emitted when a modem is connected
*/
valueobject ModemAddedEvent extends ModemEvent {
};
/**
* Event emitted when a modem is disconnected
*/
valueobject ModemRemovedEvent extends ModemEvent {
};
/**
* @brief Get port meta data
*
* @return -- Meta data
*/
MetaData getMetaData();
/**
* @brief Get current settings
*
* @return -- Settings
*/
Settings getSettings();
/**
* @brief Set settings
*
* @param settings -- new settings
*
* @return SUCCESS -- on success
* @return ERR_INVALID_VALUE -- if any passed value was invalid
*/
int setSettings(in Settings settings);
/**
* @brief Get current port state
*
* @return -- Port state
*/
State getState();
/**
* @brief Get modem connected to port
*
* @return -- an instance of the connected modem (either
* {@link AnalogModem} or {@link GsmModem})
*/
Object getModem();
};
}
serial::SerialPort
Interface describing a physical serial port and the devices which can be attached to it.
Definition SerialPort.idl:16
serial::SerialPort::setSettings
int setSettings(in Settings settings)
Set settings.
serial::SerialPort::BaudRate
BaudRate
Possible baud rates.
Definition SerialPort.idl:46
serial::SerialPort::BR57600
@ BR57600
57::600 kbit/s
Definition SerialPort.idl:53
serial::SerialPort::BR38400
@ BR38400
38::400 kbit/s
Definition SerialPort.idl:52
serial::SerialPort::BR1200
@ BR1200
1.200 kbit/s
Definition SerialPort.idl:47
serial::SerialPort::BR9600
@ BR9600
9.600 kbit/s
Definition SerialPort.idl:50
serial::SerialPort::BR115200
@ BR115200
115::200 kbit/s
Definition SerialPort.idl:54
serial::SerialPort::BR4800
@ BR4800
4.800 kbit/s
Definition SerialPort.idl:49
serial::SerialPort::BR2400
@ BR2400
2.400 kbit/s
Definition SerialPort.idl:48
serial::SerialPort::BR19200
@ BR19200
19::200 kbit/s
Definition SerialPort.idl:51
serial::SerialPort::SUCCESS
constant int SUCCESS
Error codes.
Definition SerialPort.idl:20
serial::SerialPort::getState
State getState()
Get current port state.
serial::SerialPort::PortState
PortState
Possible states the port can be in at a given time.
Definition SerialPort.idl:26
serial::SerialPort::GSMMODEM
@ GSMMODEM
A GSM modem is attached to the port.
Definition SerialPort.idl:29
serial::SerialPort::CONSOLE
@ CONSOLE
The console application is running on the port.
Definition SerialPort.idl:27
serial::SerialPort::DISCONNECTED
@ DISCONNECTED
No device matching the configured mode is detected.
Definition SerialPort.idl:30
serial::SerialPort::ANALOGMODEM
@ ANALOGMODEM
An analog modem is attached to the port.
Definition SerialPort.idl:28
serial::SerialPort::DetectionType
DetectionType
Device type the port shall be looking for.
Definition SerialPort.idl:36
serial::SerialPort::FORCE_GSMMODEM
@ FORCE_GSMMODEM
Always assume a GSM modem is connected.
Definition SerialPort.idl:40
serial::SerialPort::FORCE_CONSOLE
@ FORCE_CONSOLE
Always assume a console (terminal) is connected.
Definition SerialPort.idl:38
serial::SerialPort::FORCE_ANALOGMODEM
@ FORCE_ANALOGMODEM
Always assume an analog modem is connected.
Definition SerialPort.idl:39
serial::SerialPort::AUTOMATIC
@ AUTOMATIC
Try to automatically determine the connected device.
Definition SerialPort.idl:37
serial::SerialPort::getMetaData
MetaData getMetaData()
Get port meta data.
serial::SerialPort::getSettings
Settings getSettings()
Get current settings.
serial::SerialPort::ERR_INVALID_VALUE
constant int ERR_INVALID_VALUE
Invalid arguments.
Definition SerialPort.idl:21
serial::SerialPort::getModem
Object getModem()
Get modem connected to port.
idl
Basic IDL definitions.
Definition Event.idl:10
serial
Serial Ports.
Definition AnalogModem.idl:12
idl::Event
Common base for all events.
Definition Event.idl:13
serial::SerialPort::MetaData
(Static) meta data containing port properties
Definition SerialPort.idl:60
serial::SerialPort::MetaData::hasModemSupport
boolean hasModemSupport
Whether or not the port can detect modems (if false, this port can only operate in console mode)
Definition SerialPort.idl:61
serial::SerialPort::ModemAddedEvent
Event emitted when a modem is connected.
Definition SerialPort.idl:93
serial::SerialPort::ModemEvent
Event emitted when the modem connection state changes.
Definition SerialPort.idl:86
serial::SerialPort::ModemEvent::modem
Object modem
Either a AnalogModem or a GsmModem.
Definition SerialPort.idl:87
serial::SerialPort::ModemRemovedEvent
Event emitted when a modem is disconnected.
Definition SerialPort.idl:99
serial::SerialPort::Settings
Port settings.
Definition SerialPort.idl:77
serial::SerialPort::Settings::consoleBaudRate
BaudRate consoleBaudRate
Baud rate to be used for running the console application.
Definition SerialPort.idl:78
serial::SerialPort::Settings::detectType
DetectionType detectType
Type of connected device to be assumed in device detection.
Definition SerialPort.idl:80
serial::SerialPort::Settings::modemBaudRate
BaudRate modemBaudRate
Baud rate to be used for communicating with an attached modem.
Definition SerialPort.idl:79
serial::SerialPort::State
Structure holding information about the current state of the port.
Definition SerialPort.idl:69
serial::SerialPort::State::deviceName
string deviceName
Name of the device currently connected.
Definition SerialPort.idl:71
serial::SerialPort::State::state
PortState state
Current connection state.
Definition SerialPort.idl:70