Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion cri_lib/cri_controller.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import logging
import socket
import threading
from datetime import datetime, timezone
from enum import Enum
from pathlib import Path
from queue import Empty, Queue
Expand Down Expand Up @@ -73,7 +74,13 @@ def __init__(self) -> None:
}
self.jog_speeds_lock = threading.Lock()

def connect(self, host: str, port: int = 3920) -> bool:
def connect(
self,
host: str,
port: int = 3920,
application_name: str = "CRI-Python-Lib",
application_version: str = "0-0-0-0",
) -> bool:
"""
Connect to iRC.

Expand All @@ -83,6 +90,10 @@ def connect(self, host: str, port: int = 3920) -> bool:
IP address or hostname of iRC
port : int
port of iRC
application_name : str
optional name of your application sent to controller
application_version: str
optional version of your application sent to controller

Returns
-------
Expand All @@ -105,6 +116,10 @@ def connect(self, host: str, port: int = 3920) -> bool:
# Start sending ALIVEJOG message
self.jog_thread.start()

hello_msg = f'INFO Hello "{application_name}" {application_version} {datetime.now(timezone.utc).strftime(format="%Y-%m-%dT%H:%M:%S")}'

self._send_command(hello_msg)

return True

except ConnectionRefusedError:
Expand Down