licel_tcpip¶
class for interacting with the ethernet controller
- class Licel.licel_tcpip.EthernetController(ip: str, port: int)¶
- CMD_EXECUTED_SUCCESS: str = 'executed'¶
Command success response
- DHCP_ACTIVATED_RESPONSE: str = 'DHCP activated'¶
DHCP activated response message
- KILL_SOCKETS_CMD: str = 'KILL SOCKETS Administrator'¶
Kill socket command message
- MAX_RECONNECTION_ATTEMPTS: int = 5¶
Maximum reconnection attempts
- MIN_PORT: int = 1¶
Valid port range (1-65535)
- SilentStat: SilentStat¶
Silent stat component
- Tr: TransientRecorder¶
Transient Recorder component
- activate_dhcp(nPort: int, passwd: str) Tuple[bool, str]¶
Activate DHCP mode on the controller.
Sends the command: TCPIP “DHCP” “<nPort>” “<passwd>”
- Parameters:
nPort – Port number for DHCP
passwd – Controller password
- Returns:
tuple of (success, response) where success is True if response equals “DHCP activated”
- Return type:
Tuple[bool, str]
- Raises:
ValueError – if passwd is not provided or port is invalid
- getCapabilities() str¶
Get the available subcomponents of the ethernet controller.
- Available subcomponents may include:
TR - for controlling transient recorder
APD - for APD remote control
PMT - for PMT remote control
PMTSPI - for controller PMT high voltage module via SPI
TIMER - for the trigger timing controller
CLOUD - for transient recorder controller cloud mode
BORE - Boresight alignment system
- Returns:
comma-separated list of ethernet controller subcomponents
- Return type:
str
- Raises:
EthernetControllerConnectionError – if unable to communicate with controller
- getID() str¶
Get the identification string from the controller.
Queries the controller for its identification information.
- Returns:
ethernet controller identification number
- Return type:
str
- Raises:
EthernetControllerConnectionError – if unable to communicate with controller
- getMilliSecs() str¶
Request the millisecond timer value of the controller.
- Returns:
millisecond timer value of the controller
- Return type:
str
- Raises:
EthernetControllerConnectionError – if unable to communicate with controller
- ip: str¶
IP address of the controller
- killSocket() None¶
Method to be used when controller is not responding.
This will attempt to connect on the controller
kill portand asks the controller to close all its open connections. This should act as a soft reset and we will be able to establish a new connection with the controller.Used internally in the reconnect mechanisms.
- Raises:
EthernetControllerConnectionError – if unable to connect to kill port.
- Returns:
None
- Return type:
None
- openConnection() None¶
Open connection to the command socket
- Raises:
EthernetControllerConnectionError – attempted connection but controller did not respond. Possible causes: controller is not connected to network or controller is already connected to other device
- Returns:
None
- openPushConnection() None¶
Open connection to the push socket
- Raises:
EthernetControllerConnectionError – attempted connection but controller did not respond. Possible causes: controller is not connected to network or controller is already connected to other device
- Returns:
None
- pmt: photomultiplier¶
Photomultiplier component
- port: int¶
Port number for command socket
- pushBuffer: bytearray¶
Push buffer for data storage
- reconnection(ConfigInfo: licel_Config.Config) None¶
Attempt to reconnect to the controller with automatic retry logic.
Handles socket renewal, connection establishment, and hardware configuration. Automatically retries up to MAX_RECONNECTION_ATTEMPTS times on failure.
- Parameters:
ConfigInfo (licel_Config.Config) – Configuration information for hardware setup
- Returns:
None
- Return type:
None
- Raises:
EthernetControllerError – if unable to reconnect after maximum attempts
- set_controller_fixed_ip(new_ip: str, mask: str, new_port: int, gateway: str, passwd: str) Tuple[bool, str]¶
Send the TCPIP command to the controller to set its network parameters.
Mirrors the behaviour of the C utility setfixedipaddress.
- Parameters:
new_ip – new IPv4 address to set on the controller
mask – subnet mask
new_port – port the controller should use after reboot
gateway – default gateway
passwd – current controller password
- Returns:
tuple of (success, response) where success is True if command executed
- Return type:
Tuple[bool, str]
- Raises:
ValueError – if any parameter is invalid
- shutdownConnection() None¶
close connection to the command socket
- Returns:
None
- shutdownPushConnection() None¶
close connection to the push socket
- Returns:
None