Skip to content
Snippets Groups Projects
Commit 65c8c87d authored by Taya Snijder's avatar Taya Snijder
Browse files

exposes buffersize and queuesize to the sst_client init function with default parameters

parent 94945a28
No related branches found
No related tags found
1 merge request!50Resolve L2SS-188 "2021 05 27 branched from master udp recv sst client"
...@@ -24,14 +24,15 @@ class sst_client(CommClient): ...@@ -24,14 +24,15 @@ class sst_client(CommClient):
def start(self): def start(self):
super().start() super().start()
def __init__(self, host, port, fault_func, streams, try_interval=2): def __init__(self, host, port, fault_func, streams, try_interval=2, queuesize=1024, buffersize=9000):
""" """
Create the sst client and connect() to it and get the object node Create the sst client and connect() to it and get the object node
""" """
self.host = host self.host = host
self.port = port self.port = port
self.timeout = 0.1 self.timeout = 0.1
self.buffersize = 9000 self.buffersize = buffersize
self.queuesize = queuesize
super().__init__(fault_func, streams, try_interval) super().__init__(fault_func, streams, try_interval)
...@@ -46,7 +47,7 @@ class sst_client(CommClient): ...@@ -46,7 +47,7 @@ class sst_client(CommClient):
Function used to connect to the client. Function used to connect to the client.
""" """
if not self.connected: if not self.connected:
self.queue = Queue(maxsize=1024) self.queue = Queue(maxsize=self.queuesize)
self.udp = UDP_Receiver(self.host, self.port, self.queue, self.streams, self.buffersize, self.timeout) self.udp = UDP_Receiver(self.host, self.port, self.queue, self.streams, self.buffersize, self.timeout)
self.sst = SST(self.queue, self.streams) self.sst = SST(self.queue, self.streams)
return super().connect() return super().connect()
......
%% Cell type:code id:waiting-chance tags: %% Cell type:code id:waiting-chance tags:
``` python ``` python
import time import time
import numpy import numpy
``` ```
%% Cell type:code id:moving-alexandria tags: %% Cell type:code id:moving-alexandria tags:
``` python ``` python
d=DeviceProxy("LTS/SST/1") d=DeviceProxy("LTS/SST/1")
``` ```
%% Cell type:code id:ranking-aluminum tags: %% Cell type:code id:ranking-aluminum tags:
``` python ``` python
state = str(d.state()) state = str(d.state())
if state == "OFF": if state == "OFF":
d.initialise() d.initialise()
time.sleep(1) time.sleep(1)
state = str(d.state()) state = str(d.state())
if state == "STANDBY": if state == "STANDBY":
d.on() d.on()
state = str(d.state()) state = str(d.state())
if state == "ON": if state == "ON":
print("Device is now in on state") print("Device is now in on state")
``` ```
%% Output %% Output
Device is now in on state Device is now in on state
%% Cell type:code id:beneficial-evidence tags: %% Cell type:code id:beneficial-evidence tags:
``` python ``` python
attr_names = d.get_attribute_list() attr_names = d.get_attribute_list()
for i in attr_names: for i in attr_names:
exec("value = print(i, d.{})".format(i)) exec("value = print(i, d.{})".format(i))
``` ```
%% Output %% Output
packet_count_R [139917203] packet_count_R [55]
last_packet_timestamp_R [1623248251] last_packet_timestamp_R [1623249385]
queue_percentage_used_R [100.] queue_percentage_used_R [0.]
State <function __get_command_func.<locals>.f at 0x7fcb20e68bf8> State <function __get_command_func.<locals>.f at 0x7fcb205fd0d0>
Status <function __get_command_func.<locals>.f at 0x7fcb20e68bf8> Status <function __get_command_func.<locals>.f at 0x7fcb205fd0d0>
%% Cell type:code id:sporting-current tags: %% Cell type:code id:sporting-current tags:
``` python ``` python
d.RCU_mask_RW = [False, False, False, False, False, False, False, False, False, False, False, False, d.RCU_mask_RW = [False, False, False, False, False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False,] False, False, False, False, False, False, False, False,]
time.sleep(1) time.sleep(1)
print(d.RCU_mask_RW) print(d.RCU_mask_RW)
monitor_rate = d.RCU_monitor_rate_RW monitor_rate = d.RCU_monitor_rate_RW
print("current monitoring rate: {}, setting to {}".format(monitor_rate, monitor_rate + 1)) print("current monitoring rate: {}, setting to {}".format(monitor_rate, monitor_rate + 1))
monitor_rate = monitor_rate + 1 monitor_rate = monitor_rate + 1
time.sleep(1) time.sleep(1)
``` ```
%% Output %% Output
3.0 3.0
%% Cell type:code id:sharing-mechanics tags: %% Cell type:code id:sharing-mechanics tags:
``` python ``` python
``` ```
%% Cell type:code id:ruled-tracy tags: %% Cell type:code id:ruled-tracy tags:
``` python ``` python
``` ```
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment