Raritan PX2/PX3 JSON-RPC API
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 */
10 module serial {
11 
12  /**
13  * Interface describing a physical serial port
14  * and the devices which can be attached to it
15  */
16  interface SerialPort_3_0_1 {
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 }
Always assume a console (terminal) is connected.
Definition: SerialPort.idl:38
2.400 kbit/s
Definition: SerialPort.idl:48
BaudRate
Possible baud rates.
Definition: SerialPort.idl:46
Structure holding information about the current state of the port.
Definition: SerialPort.idl:69
Port settings.
Definition: SerialPort.idl:77
19::200 kbit/s
Definition: SerialPort.idl:51
(Static) meta data containing port properties
Definition: SerialPort.idl:60
PortState state
Current connection state.
Definition: SerialPort.idl:70
Always assume an analog modem is connected.
Definition: SerialPort.idl:39
The console application is running on the port.
Definition: SerialPort.idl:27
DetectionType
Device type the port shall be looking for.
Definition: SerialPort.idl:36
An analog modem is attached to the port.
Definition: SerialPort.idl:28
Serial Ports.
Definition: AnalogModem.idl:12
Basic IDL definitions.
Definition: Event.idl:10
38::400 kbit/s
Definition: SerialPort.idl:52
A GSM modem is attached to the port.
Definition: SerialPort.idl:29
BaudRate modemBaudRate
Baud rate to be used for communicating with an attached modem.
Definition: SerialPort.idl:79
boolean hasModemSupport
Whether or not the port can detect modems (if false, this port can only operate in console mode) ...
Definition: SerialPort.idl:61
4.800 kbit/s
Definition: SerialPort.idl:49
string deviceName
Name of the device currently connected.
Definition: SerialPort.idl:71
Try to automatically determine the connected device.
Definition: SerialPort.idl:37
Interface describing a physical serial port and the devices which can be attached to it...
Definition: SerialPort.idl:16
DetectionType detectType
Type of connected device to be assumed in device detection.
Definition: SerialPort.idl:80
PortState
Possible states the port can be in at a given time.
Definition: SerialPort.idl:26
57::600 kbit/s
Definition: SerialPort.idl:53
BaudRate consoleBaudRate
Baud rate to be used for running the console application.
Definition: SerialPort.idl:78
9.600 kbit/s
Definition: SerialPort.idl:50
1.200 kbit/s
Definition: SerialPort.idl:47