Legrand / Raritan / Server Technology Xerus™ JSON-RPC API

Loading...
Searching...
No Matches
SerialPort.idl
1/* SPDX-License-Identifier: BSD-3-Clause */
2/*
3 * Copyright 2011 Raritan Inc. All rights reserved.
4 */
5
6#include <GsmModem.idl>
7#include <AnalogModem.idl>
8
9/** Serial Ports */
10module serial {
11
12 /**
13 * Interface describing a physical serial port
14 * and the devices which can be attached to it
15 */
16 interface SerialPort {
17 /**
18 * Error codes
19 */
20 constant int SUCCESS = 0; ///< No error
21 constant int ERR_INVALID_VALUE = 1; ///< Invalid arguments
22
23 /**
24 * Possible states the port can be in at a given time
25 */
26 enumeration PortState {
27 CONSOLE, ///< The console application is running on the port
28 ANALOGMODEM, ///< An analog modem is attached to the port
29 GSMMODEM, ///< A GSM modem is attached to the port
30 DISCONNECTED ///< No device matching the configured mode is detected
31 };
32
33 /**
34 * Device type the port shall be looking for
35 */
36 enumeration DetectionType {
37 AUTOMATIC, ///< Try to automatically determine the connected device
38 FORCE_CONSOLE, ///< Always assume a console (terminal) is connected
39 FORCE_ANALOGMODEM, ///< Always assume an analog modem is connected
40 FORCE_GSMMODEM ///< Always assume a GSM modem is connected
41 };
42
43 /**
44 * Possible baud rates
45 */
46 enumeration BaudRate {
47 BR1200, ///< 1.200 kbit/s
48 BR2400, ///< 2.400 kbit/s
49 BR4800, ///< 4.800 kbit/s
50 BR9600, ///< 9.600 kbit/s
51 BR19200, ///< 19.200 kbit/s
52 BR38400, ///< 38.400 kbit/s
53 BR57600, ///< 57.600 kbit/s
54 BR115200 ///< 115.200 kbit/s
55 };
56
57 /**
58 * (Static) meta data containing port properties
59 */
60 structure MetaData {
61 boolean hasModemSupport; ///< Whether or not the port can detect modems (if false,
62 ///< this port can only operate in console mode)
63 };
64
65 /**
66 * Structure holding information about
67 * the current state of the port
68 */
69 structure State {
70 PortState state; ///< Current connection state
71 string deviceName; ///< Name of the device currently connected
72 };
73
74 /**
75 * Port settings
76 */
77 structure Settings {
78 BaudRate consoleBaudRate; ///< Baud rate to be used for running the console application
79 BaudRate modemBaudRate; ///< Baud rate to be used for communicating with an attached modem
80 DetectionType detectType; ///< Type of connected device to be assumed in device detection
81 };
82
83 /**
84 * Event emitted when the modem connection state changes
85 */
86 valueobject ModemEvent extends idl.Event {
87 Object modem; ///< Either a {@link AnalogModem} or a {@link GsmModem}
88 };
89
90 /**
91 * Event emitted when a modem is connected
92 */
93 valueobject ModemAddedEvent extends ModemEvent {
94 };
95
96 /**
97 * Event emitted when a modem is disconnected
98 */
99 valueobject ModemRemovedEvent extends ModemEvent {
100 };
101
102 /**
103 * @brief Get port meta data
104 *
105 * @return -- Meta data
106 */
107 MetaData getMetaData();
108
109 /**
110 * @brief Get current settings
111 *
112 * @return -- Settings
113 */
114 Settings getSettings();
115
116 /**
117 * @brief Set settings
118 *
119 * @param settings -- new settings
120 *
121 * @return SUCCESS -- on success
122 * @return ERR_INVALID_VALUE -- if any passed value was invalid
123 */
124 int setSettings(in Settings settings);
125
126 /**
127 * @brief Get current port state
128 *
129 * @return -- Port state
130 */
131 State getState();
132
133 /**
134 * @brief Get modem connected to port
135 *
136 * @return -- an instance of the connected modem (either
137 * {@link AnalogModem} or {@link GsmModem})
138 */
139 Object getModem();
140 };
141
142}
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::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::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::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_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::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