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 */
108
109 /**
110 * @brief Get current settings
111 *
112 * @return -- Settings
113 */
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 */
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}
Interface describing a physical serial port and the devices which can be attached to it.
int setSettings(in Settings settings)
Set settings.
BaudRate
Possible baud rates.
@ BR57600
57::600 kbit/s
@ BR38400
38::400 kbit/s
@ BR1200
1.200 kbit/s
@ BR9600
9.600 kbit/s
@ BR4800
4.800 kbit/s
@ BR2400
2.400 kbit/s
@ BR19200
19::200 kbit/s
State getState()
Get current port state.
PortState
Possible states the port can be in at a given time.
@ GSMMODEM
A GSM modem is attached to the port.
@ CONSOLE
The console application is running on the port.
@ ANALOGMODEM
An analog modem is attached to the port.
DetectionType
Device type the port shall be looking for.
@ FORCE_CONSOLE
Always assume a console (terminal) is connected.
@ FORCE_ANALOGMODEM
Always assume an analog modem is connected.
@ AUTOMATIC
Try to automatically determine the connected device.
MetaData getMetaData()
Get port meta data.
Settings getSettings()
Get current settings.
Object getModem()
Get modem connected to port.
Basic IDL definitions.
Definition Event.idl:10
Serial Ports.
Common base for all events.
Definition Event.idl:13
(Static) meta data containing port properties
boolean hasModemSupport
Whether or not the port can detect modems (if false, this port can only operate in console mode)
Event emitted when a modem is connected.
Event emitted when the modem connection state changes.
Object modem
Either a AnalogModem or a GsmModem.
Event emitted when a modem is disconnected.
BaudRate consoleBaudRate
Baud rate to be used for running the console application.
DetectionType detectType
Type of connected device to be assumed in device detection.
BaudRate modemBaudRate
Baud rate to be used for communicating with an attached modem.
Structure holding information about the current state of the port.
string deviceName
Name of the device currently connected.
PortState state
Current connection state.