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 */
96
97 /**
98 * Get current port settings.
99 *
100 * @return Port settings.
101 */
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 */
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 port interface.
Definition DsamPort.idl:14
Info getInfo()
Get current port info.
Settings getSettings()
Get current port settings.
int getTtyUsbNumber()
Get the number of the ttyUSB device.
State
Port state.
Definition DsamPort.idl:46
@ STATE_AVAILABLE
no clients connected to port
Definition DsamPort.idl:47
@ STATE_OCCUPIED
at least one client connected, more clients allowed
Definition DsamPort.idl:48
int setSettings(in Settings settings)
Set port settings.
DeviceInterfaceType
Serial device interface type.
Definition DsamPort.idl:25
@ DEV_IFTYPE_AUTO
auto detect
Definition DsamPort.idl:26
@ DEV_IFTYPE_DTE
DTE (Data Terminal Equipment) device detected.
Definition DsamPort.idl:27
FlowControl
Flow control type.
Definition DsamPort.idl:39
@ FLOW_CTRL_HARDWARE
Hardware flow control.
Definition DsamPort.idl:41
@ FLOW_CTRL_NONE
No flow control.
Definition DsamPort.idl:40
Parity
Parity mode.
Definition DsamPort.idl:32
@ PARITY_ODD
Odd parity (implies 7 data bits)
Definition DsamPort.idl:34
@ PARITY_NONE
No parity (implies 8 data bits)
Definition DsamPort.idl:33
void setState(in State state)
Set the state of the port.
Event that is send when the port info has changed.
Definition DsamPort.idl:76
string portName
current port name
Definition DsamPort.idl:79
boolean connected
true if serial device is connected
Definition DsamPort.idl:56
State state
state of the port
Definition DsamPort.idl:58
int dsamNumber
DSAM number (1-based)
Definition DsamPort.idl:54
int portNumber
port number (1-based)
Definition DsamPort.idl:55
DeviceInterfaceType devIfType
serial device interface type if connected is true
Definition DsamPort.idl:57
Event that is send whenthe port settings have changed.
Definition DsamPort.idl:83
Settings oldSettings
Old port settings.
Definition DsamPort.idl:86
Settings newSettings
New port settings.
Definition DsamPort.idl:87
int breakDurationMs
Length of BREAK signal duration in milli seconds.
Definition DsamPort.idl:69
int baudRate
Baud rate.
Definition DsamPort.idl:65
int sshDpaPort
SSH DPA port number.
Definition DsamPort.idl:71
FlowControl flowCtrl
Flow control type.
Definition DsamPort.idl:68
boolean allowSharedAccess
Allow more than one user to connect to this port.
Definition DsamPort.idl:72
DeviceInterfaceType devIfType
Port interface type (allows forcing the interface type)
Definition DsamPort.idl:64
int stopBits
Number of stop bits (1 or 2)
Definition DsamPort.idl:67
string name
Port name.
Definition DsamPort.idl:63
boolean sshDpaPortEnabled
true if dedicated SSH DPA port is enabled
Definition DsamPort.idl:70
Parity parity
Parity mode.
Definition DsamPort.idl:66