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

Loading...
Searching...
No Matches
DsamPort.idl
1/* SPDX-License-Identifier: BSD-3-Clause */
2/*
3 * Copyright 2022 Raritan Inc. All rights reserved.
4 */
5
6#ifndef __DSAMPORT_IDL__
7#define __DSAMPORT_IDL__
8
9#include <UserEvent.idl>
10
11module dsam {
12
13 /** DSAM port interface */
14 interface DsamPort {
15
16 /** Success code */
17 constant int SUCCESS = 0;
18
19 /** Error codes */
20 constant int SETTINGS_INVALID = 1;
21 constant int SSH_DPA_PORT_INVALID = 2;
22 constant int SSH_DPA_PORT_IN_USE = 3;
23
24 /** Serial device interface type */
25 enumeration DeviceInterfaceType {
26 DEV_IFTYPE_AUTO, ///< auto detect
27 DEV_IFTYPE_DTE, ///< DTE (Data Terminal Equipment) device detected
28 DEV_IFTYPE_DCE ///< DCE (Data Communications Equipment) device detected
29 };
30
31 /** Parity mode */
32 enumeration Parity {
33 PARITY_NONE, ///< No parity (implies 8 data bits)
34 PARITY_ODD, ///< Odd parity (implies 7 data bits)
35 PARITY_EVEN ///< Even parity (implies 7 data bits)
36 };
37
38 /** Flow control type */
39 enumeration FlowControl {
40 FLOW_CTRL_NONE, ///< No flow control
41 FLOW_CTRL_HARDWARE, ///< Hardware flow control
42 FLOW_CTRL_SOFTWARE ///< Software flow control
43 };
44
45 /** Port state */
46 enumeration State {
47 STATE_AVAILABLE, ///< no clients connected to port
48 STATE_OCCUPIED, ///< at least one client connected, more clients allowed
49 STATE_BUSY ///< no more clients allowed
50 };
51
52 /** Port info */
53 structure Info {
54 int dsamNumber; ///< DSAM number (1-based)
55 int portNumber; ///< port number (1-based)
56 boolean connected; ///< \c true if serial device is connected
57 DeviceInterfaceType devIfType; ///< serial device interface type if \c connected is \c true
58 State state; ///< state of the port
59 };
60
61 /** Port settings */
62 structure Settings {
63 string name; ///< Port name
64 DeviceInterfaceType devIfType; ///< Port interface type (allows forcing the interface type)
65 int baudRate; ///< Baud rate
66 Parity parity; ///< Parity mode
67 int stopBits; ///< Number of stop bits (1 or 2)
68 FlowControl flowCtrl; ///< Flow control type
69 int breakDurationMs; ///< Length of BREAK signal duration in milli seconds
70 boolean sshDpaPortEnabled; ///< \c true if dedicated SSH DPA port is enabled
71 int sshDpaPort; ///< SSH DPA port number
72 boolean allowSharedAccess; ///< Allow more than one user to connect to this port
73 };
74
75 /** Event that is send when the port info has changed */
76 valueobject InfoChangedEvent extends event.UserEvent {
77 Info oldInfo; ///< Old port info
78 Info newInfo; ///< New port info
79 string portName; ///< current port name
80 };
81
82 /** Event that is send whenthe port settings have changed */
83 valueobject SettingsChangedEvent extends event.UserEvent {
84 int dsamNumber; ///< DSAM number
85 int portNumber; ///< port number
86 Settings oldSettings; ///< Old port settings
87 Settings newSettings; ///< New port settings
88 };
89
90 /**
91 * Get current port info.
92 *
93 * @return Port info
94 */
95 Info getInfo();
96
97 /**
98 * Get current port settings.
99 *
100 * @return Port settings.
101 */
102 Settings getSettings();
103
104 /**
105 * Set port settings.
106 *
107 * @param settings Port settings
108 * @return SUCCESS if no error occured or one of the defined error codes
109 */
110 int setSettings(in Settings settings);
111
112 /**
113 * Get the number of the ttyUSB device.
114 *
115 * NOTE: This function is only used internally and is not available via JSON-RPC.
116 *
117 * @return ttyUSB device number
118 */
119 int getTtyUsbNumber();
120
121 /**
122 * Set the state of the port.
123 *
124 * NOTE: This function is only used internally and is not available via JSON-RPC.
125 *
126 * @param state Port state
127 */
128 void setState(in State state);
129 };
130}
131
132#endif // __DSAM_PORT__
dsam::DsamPort
DSAM port interface.
Definition DsamPort.idl:14
dsam::DsamPort::getInfo
Info getInfo()
Get current port info.
dsam::DsamPort::getSettings
Settings getSettings()
Get current port settings.
dsam::DsamPort::getTtyUsbNumber
int getTtyUsbNumber()
Get the number of the ttyUSB device.
dsam::DsamPort::State
State
Port state.
Definition DsamPort.idl:46
dsam::DsamPort::STATE_AVAILABLE
@ STATE_AVAILABLE
no clients connected to port
Definition DsamPort.idl:47
dsam::DsamPort::STATE_OCCUPIED
@ STATE_OCCUPIED
at least one client connected, more clients allowed
Definition DsamPort.idl:48
dsam::DsamPort::setSettings
int setSettings(in Settings settings)
Set port settings.
dsam::DsamPort::DeviceInterfaceType
DeviceInterfaceType
Serial device interface type.
Definition DsamPort.idl:25
dsam::DsamPort::DEV_IFTYPE_AUTO
@ DEV_IFTYPE_AUTO
auto detect
Definition DsamPort.idl:26
dsam::DsamPort::DEV_IFTYPE_DTE
@ DEV_IFTYPE_DTE
DTE (Data Terminal Equipment) device detected.
Definition DsamPort.idl:27
dsam::DsamPort::FlowControl
FlowControl
Flow control type.
Definition DsamPort.idl:39
dsam::DsamPort::FLOW_CTRL_HARDWARE
@ FLOW_CTRL_HARDWARE
Hardware flow control.
Definition DsamPort.idl:41
dsam::DsamPort::FLOW_CTRL_NONE
@ FLOW_CTRL_NONE
No flow control.
Definition DsamPort.idl:40
dsam::DsamPort::Parity
Parity
Parity mode.
Definition DsamPort.idl:32
dsam::DsamPort::PARITY_ODD
@ PARITY_ODD
Odd parity (implies 7 data bits)
Definition DsamPort.idl:34
dsam::DsamPort::PARITY_NONE
@ PARITY_NONE
No parity (implies 8 data bits)
Definition DsamPort.idl:33
dsam::DsamPort::setState
void setState(in State state)
Set the state of the port.
dsam::DsamPort::InfoChangedEvent
Event that is send when the port info has changed.
Definition DsamPort.idl:76
dsam::DsamPort::InfoChangedEvent::oldInfo
Info oldInfo
Old port info.
Definition DsamPort.idl:77
dsam::DsamPort::InfoChangedEvent::portName
string portName
current port name
Definition DsamPort.idl:79
dsam::DsamPort::InfoChangedEvent::newInfo
Info newInfo
New port info.
Definition DsamPort.idl:78
dsam::DsamPort::Info
Port info.
Definition DsamPort.idl:53
dsam::DsamPort::Info::connected
boolean connected
true if serial device is connected
Definition DsamPort.idl:56
dsam::DsamPort::Info::state
State state
state of the port
Definition DsamPort.idl:58
dsam::DsamPort::Info::dsamNumber
int dsamNumber
DSAM number (1-based)
Definition DsamPort.idl:54
dsam::DsamPort::Info::portNumber
int portNumber
port number (1-based)
Definition DsamPort.idl:55
dsam::DsamPort::Info::devIfType
DeviceInterfaceType devIfType
serial device interface type if connected is true
Definition DsamPort.idl:57
dsam::DsamPort::SettingsChangedEvent
Event that is send whenthe port settings have changed.
Definition DsamPort.idl:83
dsam::DsamPort::SettingsChangedEvent::portNumber
int portNumber
port number
Definition DsamPort.idl:85
dsam::DsamPort::SettingsChangedEvent::oldSettings
Settings oldSettings
Old port settings.
Definition DsamPort.idl:86
dsam::DsamPort::SettingsChangedEvent::dsamNumber
int dsamNumber
DSAM number.
Definition DsamPort.idl:84
dsam::DsamPort::SettingsChangedEvent::newSettings
Settings newSettings
New port settings.
Definition DsamPort.idl:87
dsam::DsamPort::Settings
Port settings.
Definition DsamPort.idl:62
dsam::DsamPort::Settings::breakDurationMs
int breakDurationMs
Length of BREAK signal duration in milli seconds.
Definition DsamPort.idl:69
dsam::DsamPort::Settings::baudRate
int baudRate
Baud rate.
Definition DsamPort.idl:65
dsam::DsamPort::Settings::sshDpaPort
int sshDpaPort
SSH DPA port number.
Definition DsamPort.idl:71
dsam::DsamPort::Settings::flowCtrl
FlowControl flowCtrl
Flow control type.
Definition DsamPort.idl:68
dsam::DsamPort::Settings::allowSharedAccess
boolean allowSharedAccess
Allow more than one user to connect to this port.
Definition DsamPort.idl:72
dsam::DsamPort::Settings::devIfType
DeviceInterfaceType devIfType
Port interface type (allows forcing the interface type)
Definition DsamPort.idl:64
dsam::DsamPort::Settings::stopBits
int stopBits
Number of stop bits (1 or 2)
Definition DsamPort.idl:67
dsam::DsamPort::Settings::name
string name
Port name.
Definition DsamPort.idl:63
dsam::DsamPort::Settings::sshDpaPortEnabled
boolean sshDpaPortEnabled
true if dedicated SSH DPA port is enabled
Definition DsamPort.idl:70
dsam::DsamPort::Settings::parity
Parity parity
Parity mode.
Definition DsamPort.idl:66