Loading...
Searching...
No Matches
DsamPort.idl
/* SPDX-License-Identifier: BSD-3-Clause */
/*
* Copyright 2022 Raritan Inc. All rights reserved.
*/
#ifndef __DSAMPORT_IDL__
#define __DSAMPORT_IDL__
#include <UserEvent.idl>
module dsam {
/** DSAM port interface */
interface DsamPort {
/** Success code */
constant int SUCCESS = 0;
/** Error codes */
constant int SETTINGS_INVALID = 1;
constant int SSH_DPA_PORT_INVALID = 2;
constant int SSH_DPA_PORT_IN_USE = 3;
/** Serial device interface type */
enumeration DeviceInterfaceType {
DEV_IFTYPE_AUTO, ///< auto detect
DEV_IFTYPE_DTE, ///< DTE (Data Terminal Equipment) device detected
DEV_IFTYPE_DCE ///< DCE (Data Communications Equipment) device detected
};
/** Parity mode */
enumeration Parity {
PARITY_NONE, ///< No parity (implies 8 data bits)
PARITY_ODD, ///< Odd parity (implies 7 data bits)
PARITY_EVEN ///< Even parity (implies 7 data bits)
};
/** Flow control type */
enumeration FlowControl {
FLOW_CTRL_NONE, ///< No flow control
FLOW_CTRL_HARDWARE, ///< Hardware flow control
FLOW_CTRL_SOFTWARE ///< Software flow control
};
/** Port state */
enumeration State {
STATE_AVAILABLE, ///< no clients connected to port
STATE_OCCUPIED, ///< at least one client connected, more clients allowed
STATE_BUSY ///< no more clients allowed
};
/** Port info */
structure Info {
int dsamNumber; ///< DSAM number (1-based)
int portNumber; ///< port number (1-based)
boolean connected; ///< \c true if serial device is connected
DeviceInterfaceType devIfType; ///< serial device interface type if \c connected is \c true
State state; ///< state of the port
};
/** Port settings */
structure Settings {
string name; ///< Port name
DeviceInterfaceType devIfType; ///< Port interface type (allows forcing the interface type)
int baudRate; ///< Baud rate
Parity parity; ///< Parity mode
int stopBits; ///< Number of stop bits (1 or 2)
FlowControl flowCtrl; ///< Flow control type
int breakDurationMs; ///< Length of BREAK signal duration in milli seconds
boolean sshDpaPortEnabled; ///< \c true if dedicated SSH DPA port is enabled
int sshDpaPort; ///< SSH DPA port number
boolean allowSharedAccess; ///< Allow more than one user to connect to this port
};
/** Event that is send when the port info has changed */
valueobject InfoChangedEvent extends event.UserEvent {
Info oldInfo; ///< Old port info
Info newInfo; ///< New port info
string portName; ///< current port name
};
/** Event that is send whenthe port settings have changed */
valueobject SettingsChangedEvent extends event.UserEvent {
int dsamNumber; ///< DSAM number
int portNumber; ///< port number
Settings oldSettings; ///< Old port settings
Settings newSettings; ///< New port settings
};
/**
* Get current port info.
*
* @return Port info
*/
Info getInfo();
/**
* Get current port settings.
*
* @return Port settings.
*/
Settings getSettings();
/**
* Set port settings.
*
* @param settings Port settings
* @return SUCCESS if no error occured or one of the defined error codes
*/
int setSettings(in Settings settings);
/**
* Get the number of the ttyUSB device.
*
* NOTE: This function is only used internally and is not available via JSON-RPC.
*
* @return ttyUSB device number
*/
int getTtyUsbNumber();
/**
* Set the state of the port.
*
* NOTE: This function is only used internally and is not available via JSON-RPC.
*
* @param state Port state
*/
void setState(in State state);
};
}
#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::SUCCESS
constant int SUCCESS
Success code.
Definition DsamPort.idl:17
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::STATE_BUSY
@ STATE_BUSY
no more clients allowed
Definition DsamPort.idl:49
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_DCE
@ DEV_IFTYPE_DCE
DCE (Data Communications Equipment) device detected.
Definition DsamPort.idl:28
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::FLOW_CTRL_SOFTWARE
@ FLOW_CTRL_SOFTWARE
Software flow control.
Definition DsamPort.idl:42
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::PARITY_EVEN
@ PARITY_EVEN
Even parity (implies 7 data bits)
Definition DsamPort.idl:35
dsam::DsamPort::SETTINGS_INVALID
constant int SETTINGS_INVALID
Error codes.
Definition DsamPort.idl:20
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