not1mm 24.9.15__py3-none-any.whl → 24.9.23__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -287,6 +287,11 @@
287
287
  <string>CQ WW CW</string>
288
288
  </property>
289
289
  </item>
290
+ <item>
291
+ <property name="text">
292
+ <string>CQ WW RTTY</string>
293
+ </property>
294
+ </item>
290
295
  <item>
291
296
  <property name="text">
292
297
  <string>CQ WW SSB</string>
@@ -376,24 +381,24 @@
376
381
  </property>
377
382
  <property name="dateTime">
378
383
  <datetime>
379
- <hour>8</hour>
384
+ <hour>0</hour>
380
385
  <minute>0</minute>
381
386
  <second>0</second>
382
387
  <year>2024</year>
383
388
  <month>1</month>
384
- <day>1</day>
389
+ <day>2</day>
385
390
  </datetime>
386
391
  </property>
387
392
  <property name="date">
388
393
  <date>
389
394
  <year>2024</year>
390
395
  <month>1</month>
391
- <day>1</day>
396
+ <day>2</day>
392
397
  </date>
393
398
  </property>
394
399
  <property name="time">
395
400
  <time>
396
- <hour>8</hour>
401
+ <hour>0</hour>
397
402
  <minute>0</minute>
398
403
  <second>0</second>
399
404
  </time>
@@ -0,0 +1,24 @@
1
+ S|F1|MyCall|{MYCALL}
2
+ S|F2|Exch|{SNT} {EXCH}
3
+ S|F3|My NR|{SENTNR}
4
+ S|F4|empty|
5
+ S|F5|AGN|agn
6
+ S|F6|?|?
7
+ S|F7|Roger|rr
8
+ S|F8|73|73
9
+ S|F9|..|ee
10
+ S|F10|Call?|cl?
11
+ S|F11|NR??|NR?
12
+ S|F12|TU|tu
13
+ R|F1|Run CQ|cq test {MYCALL} {MYCALL} test
14
+ R|F2|HisCall|{HISCALL}
15
+ R|F3|Run Exch|{HISCALL} {SNT} {EXCH}
16
+ R|F4|Run TU|tu {MYCALL} qrz
17
+ R|F5|MyCall|{MYCALL}
18
+ R|F6|MyNR|{SENTNR}
19
+ R|F7|?|?
20
+ R|F8|Roger|rr
21
+ R|F9|AGN|agn
22
+ R|F10|Call?|cl?
23
+ R|F11|NR?|NR?
24
+ R|F12|Ack Call?|{HISCALL} rr tu
@@ -90,7 +90,7 @@ class CAT:
90
90
  def __initialize_rigctrld(self):
91
91
  try:
92
92
  self.rigctrlsocket = socket.socket()
93
- self.rigctrlsocket.settimeout(0.5)
93
+ self.rigctrlsocket.settimeout(0.1)
94
94
  self.rigctrlsocket.connect((self.host, self.port))
95
95
  logger.debug("Connected to rigctrld")
96
96
  self.online = True
@@ -104,6 +104,18 @@ class CAT:
104
104
  if self.interface == "rigctld":
105
105
  self.__initialize_rigctrld()
106
106
 
107
+ def __get_serial_string(self):
108
+ """Gets any serial data waiting"""
109
+ dump = ""
110
+ thegrab = ""
111
+ try:
112
+ while True:
113
+ thegrab += self.rigctrlsocket.recv(1024).decode()
114
+ dump += thegrab
115
+ except socket.error:
116
+ ...
117
+ return dump
118
+
107
119
  def sendcw(self, texttosend):
108
120
  """..."""
109
121
  logger.debug(f"{texttosend=} {self.interface=}")
@@ -119,7 +131,7 @@ class CAT:
119
131
  try:
120
132
  self.online = True
121
133
  self.rigctrlsocket.send(bytes(f"b{texttosend}\n", "utf-8"))
122
- _ = self.rigctrlsocket.recv(1024).decode().strip()
134
+ _ = self.__get_serial_string()
123
135
  return True
124
136
  except socket.error as exception:
125
137
  self.online = False
@@ -216,7 +228,7 @@ class CAT:
216
228
  try:
217
229
  self.online = True
218
230
  self.rigctrlsocket.send(b"f\n")
219
- return self.rigctrlsocket.recv(1024).decode().strip()
231
+ return self.__get_serial_string().strip()
220
232
  except socket.error as exception:
221
233
  self.online = False
222
234
  logger.debug("getvfo_rigctld: %s", f"{exception}")
@@ -237,6 +249,8 @@ class CAT:
237
249
 
238
250
  def __getmode_flrig(self) -> str:
239
251
  """Returns mode via flrig"""
252
+ # QMX ['CW-U', 'CW-L', 'DIGI-U', 'DIGI-L']
253
+ # 7300 ['LSB', 'USB', 'AM', 'FM', 'CW', 'CW-R', 'RTTY', 'RTTY-R', 'LSB-D', 'USB-D', 'AM-D', 'FM-D']
240
254
  try:
241
255
  self.online = True
242
256
  return self.server.rig.get_mode()
@@ -253,11 +267,13 @@ class CAT:
253
267
 
254
268
  def __getmode_rigctld(self) -> str:
255
269
  """Returns mode vai rigctld"""
270
+ # QMX 'AM CW USB LSB RTTY FM CWR RTTYR'
271
+ # 7300 'AM CW USB LSB RTTY FM CWR RTTYR PKTLSB PKTUSB FM-D AM-D'
256
272
  if self.rigctrlsocket:
257
273
  try:
258
274
  self.online = True
259
275
  self.rigctrlsocket.send(b"m\n")
260
- mode = self.rigctrlsocket.recv(1024).decode()
276
+ mode = self.__get_serial_string()
261
277
  mode = mode.strip().split()[0]
262
278
  # logger.debug("%s", mode)
263
279
  return mode
@@ -302,7 +318,7 @@ class CAT:
302
318
  try:
303
319
  self.online = True
304
320
  self.rigctrlsocket.send(b"m\n")
305
- mode = self.rigctrlsocket.recv(1024).decode()
321
+ mode = self.__get_serial_string()
306
322
  mode = mode.strip().split()[1]
307
323
  # logger.debug("%s", mode)
308
324
  return mode
@@ -344,7 +360,7 @@ class CAT:
344
360
  try:
345
361
  self.online = True
346
362
  self.rigctrlsocket.send(b"l RFPOWER\n")
347
- return int(float(self.rigctrlsocket.recv(1024).decode().strip()) * 100)
363
+ return int(float(self.__get_serial_string().strip()) * 100)
348
364
  except socket.error as exception:
349
365
  self.online = False
350
366
  logger.debug("getpower_rigctld: %s", f"{exception}")
@@ -381,7 +397,7 @@ class CAT:
381
397
  try:
382
398
  self.online = True
383
399
  self.rigctrlsocket.send(b"t\n")
384
- ptt = self.rigctrlsocket.recv(1024).decode()
400
+ ptt = self.__get_serial_string()
385
401
  logger.debug("%s", ptt)
386
402
  ptt = ptt.strip()
387
403
  return ptt
@@ -391,6 +407,49 @@ class CAT:
391
407
  self.rigctrlsocket = None
392
408
  return "0"
393
409
 
410
+ def get_mode_list(self):
411
+ "Get a list of modes supported by the radio"
412
+ if self.interface == "flrig":
413
+ return self.__get_mode_list_flrig()
414
+ if self.interface == "rigctld":
415
+ return self.__get_mode_list_rigctld()
416
+ return False
417
+
418
+ def __get_mode_list_flrig(self):
419
+ """Returns list of modes supported by the radio"""
420
+ try:
421
+ self.online = True
422
+ return self.server.rig.get_modes()
423
+ except (
424
+ ConnectionRefusedError,
425
+ xmlrpc.client.Fault,
426
+ http.client.BadStatusLine,
427
+ http.client.CannotSendRequest,
428
+ http.client.ResponseNotReady,
429
+ ) as exception:
430
+ self.online = False
431
+ logger.debug("%s", f"{exception}")
432
+ return ""
433
+
434
+ def __get_mode_list_rigctld(self):
435
+ """Returns list of modes supported by the radio"""
436
+ # Mode list: AM CW USB LSB RTTY FM CWR RTTYR
437
+ if self.rigctrlsocket:
438
+ try:
439
+ self.online = True
440
+ self.rigctrlsocket.send(b"1\n")
441
+ dump = self.__get_serial_string()
442
+ for line in dump.splitlines():
443
+ if "Mode list:" in line:
444
+ modes = line.split(":")[1].strip()
445
+ return modes
446
+ return ""
447
+ except socket.error as exception:
448
+ self.online = False
449
+ logger.debug("%s", f"{exception}")
450
+ self.rigctrlsocket = None
451
+ return ""
452
+
394
453
  def set_vfo(self, freq: str) -> bool:
395
454
  """Sets the radios vfo"""
396
455
  try:
@@ -424,7 +483,7 @@ class CAT:
424
483
  try:
425
484
  self.online = True
426
485
  self.rigctrlsocket.send(bytes(f"F {freq}\n", "utf-8"))
427
- _ = self.rigctrlsocket.recv(1024).decode().strip()
486
+ _ = self.__get_serial_string()
428
487
  return True
429
488
  except socket.error as exception:
430
489
  self.online = False
@@ -464,7 +523,7 @@ class CAT:
464
523
  try:
465
524
  self.online = True
466
525
  self.rigctrlsocket.send(bytes(f"M {mode} 0\n", "utf-8"))
467
- _ = self.rigctrlsocket.recv(1024).decode().strip()
526
+ _ = self.__get_serial_string()
468
527
  return True
469
528
  except socket.error as exception:
470
529
  self.online = False
@@ -503,7 +562,7 @@ class CAT:
503
562
  try:
504
563
  self.online = True
505
564
  self.rigctrlsocket.send(rig_cmd)
506
- _ = self.rigctrlsocket.recv(1024).decode().strip()
565
+ _ = self.__get_serial_string()
507
566
  except socket.error:
508
567
  self.online = False
509
568
  self.rigctrlsocket = None
@@ -532,7 +591,7 @@ class CAT:
532
591
  try:
533
592
  self.online = True
534
593
  self.rigctrlsocket.send(rig_cmd)
535
- _ = self.rigctrlsocket.recv(1024).decode().strip()
594
+ _ = self.__get_serial_string()
536
595
  except socket.error:
537
596
  self.online = False
538
597
  self.rigctrlsocket = None
@@ -568,7 +627,7 @@ class CAT:
568
627
  try:
569
628
  self.online = True
570
629
  self.rigctrlsocket.send(rig_cmd)
571
- _ = self.rigctrlsocket.recv(1024).decode().strip()
630
+ _ = self.__get_serial_string()
572
631
  except socket.error:
573
632
  self.online = False
574
633
  self.rigctrlsocket = None
not1mm/lib/cwinterface.py CHANGED
@@ -50,35 +50,43 @@ class CW:
50
50
  def sendcw(self, texttosend):
51
51
  """sends cw to k1el"""
52
52
  logger.debug(f"{texttosend=} {self.servertype=}")
53
- if self.servertype == 2:
54
- self._sendcw_xmlrpc(texttosend)
55
- if self.servertype == 1:
56
- self._sendcw_udp(texttosend)
57
- if self.servertype == 3 and self.cw is not None:
58
- self._sendcwcat(texttosend)
53
+ if texttosend:
54
+ if self.servertype == 2:
55
+ self._sendcw_xmlrpc(texttosend)
56
+ if self.servertype == 1:
57
+ self._sendcw_udp(texttosend)
58
+ if self.servertype == 3 and self.cw is not None:
59
+ self._sendcwcat(texttosend)
59
60
 
60
61
  def _sendcw_xmlrpc(self, texttosend):
61
62
  """sends cw to xmlrpc"""
62
63
  logger.debug("xmlrpc: %s", texttosend)
63
- with ServerProxy(f"http://{self.host}:{self.port}") as proxy:
64
- try:
65
- proxy.k1elsendstring(texttosend)
66
- except Error as exception:
67
- logger.debug(
68
- "http://%s:%s, xmlrpc error: %s", self.host, self.port, exception
69
- )
70
- except ConnectionRefusedError:
71
- logger.debug(
72
- "http://%s:%s, xmlrpc Connection Refused", self.host, self.port
73
- )
64
+ if texttosend:
65
+ with ServerProxy(f"http://{self.host}:{self.port}") as proxy:
66
+ try:
67
+ proxy.k1elsendstring(texttosend)
68
+ except Error as exception:
69
+ logger.debug(
70
+ "http://%s:%s, xmlrpc error: %s",
71
+ self.host,
72
+ self.port,
73
+ exception,
74
+ )
75
+ except ConnectionRefusedError:
76
+ logger.debug(
77
+ "http://%s:%s, xmlrpc Connection Refused", self.host, self.port
78
+ )
74
79
 
75
80
  def _sendcw_udp(self, texttosend):
76
81
  """send cw to udp port"""
77
82
  logger.debug("UDP: %s", texttosend)
78
- server_address_port = (self.host, self.port)
79
- # bufferSize = 1024
80
- udp_client_socket = socket.socket(family=socket.AF_INET, type=socket.SOCK_DGRAM)
81
- udp_client_socket.sendto(bytes(texttosend, "utf-8"), server_address_port)
83
+ if texttosend:
84
+ server_address_port = (self.host, self.port)
85
+ # bufferSize = 1024
86
+ udp_client_socket = socket.socket(
87
+ family=socket.AF_INET, type=socket.SOCK_DGRAM
88
+ )
89
+ udp_client_socket.sendto(bytes(texttosend, "utf-8"), server_address_port)
82
90
 
83
91
  def _sendcwcat(self, texttosend):
84
92
  """..."""
@@ -0,0 +1,23 @@
1
+ import xmlrpc.client
2
+
3
+
4
+ class FlDigi_Comm:
5
+ """Send strings to fldigi for RTTY"""
6
+
7
+ def __init__(self):
8
+ self.target = "http://127.0.0.1:7362"
9
+
10
+ def send_string(
11
+ self, message: str = None, nlbefore: bool = True, rxafter: bool = True
12
+ ):
13
+ """send string"""
14
+ try:
15
+ server = xmlrpc.client.ServerProxy(self.target)
16
+ server.main.tx()
17
+ if nlbefore:
18
+ message = f"\n{message}"
19
+ if rxafter:
20
+ message = f"{message}^r"
21
+ server.text.add_tx(message)
22
+ except OSError:
23
+ ...
not1mm/lib/lookup.py CHANGED
@@ -188,7 +188,10 @@ class QRZlookup:
188
188
  payload = {"s": self.session, "callsign": call}
189
189
  try:
190
190
  query_result = requests.get(self.qrzurl, params=payload, timeout=10.0)
191
- except requests.exceptions.Timeout as exception:
191
+ except (
192
+ requests.exceptions.Timeout,
193
+ requests.exceptions.ConnectionError,
194
+ ) as exception:
192
195
  self.error = True
193
196
  return {"error": exception}
194
197
  baseroot = xmltodict.parse(query_result.text)
@@ -228,8 +231,8 @@ class HamQTH:
228
231
  self.session = False
229
232
  payload = {"u": self.username, "p": self.password}
230
233
  try:
231
- query_result = requests.get(self.url, params=payload, timeout=10.0)
232
- except requests.exceptions.Timeout:
234
+ query_result = requests.get(self.url, params=payload, timeout=2.0)
235
+ except (requests.exceptions.Timeout, requests.exceptions.ConnectionError):
233
236
  self.error = True
234
237
  return
235
238
  logger.info("resultcode: %s", query_result.status_code)
@@ -258,7 +261,7 @@ class HamQTH:
258
261
  payload = {"id": self.session, "callsign": call, "prg": "not1mm"}
259
262
  try:
260
263
  query_result = requests.get(self.url, params=payload, timeout=10.0)
261
- except requests.exceptions.Timeout:
264
+ except (requests.exceptions.Timeout, requests.exceptions.ConnectionError):
262
265
  self.error = True
263
266
  return the_result
264
267
  logger.info("resultcode: %s", query_result.status_code)
@@ -189,6 +189,15 @@ def gen_adif(self, cabrillo_name: str, contest_id=""):
189
189
  end="\r\n",
190
190
  file=file_descriptor,
191
191
  )
192
+ # ------------CQ-WW-DX-RTTY---------
193
+ elif cabrillo_name == "CQ-WW-RTTY":
194
+ rcv = f"{str(contact.get('ZN', '')).zfill(2)} {contact.get('Exchange1', 'DX')}"
195
+ if len(rcv) > 1:
196
+ print(
197
+ f"<SRX_STRING:{len(rcv)}>{rcv.upper()}",
198
+ end="\r\n",
199
+ file=file_descriptor,
200
+ )
192
201
  elif rcvnr != "0":
193
202
  print(
194
203
  f"<SRX_STRING:{len(rcvnr)}>{rcvnr}",
not1mm/lib/version.py CHANGED
@@ -1,3 +1,3 @@
1
1
  """It's the version"""
2
2
 
3
- __version__ = "24.9.15"
3
+ __version__ = "24.9.23"
@@ -1,5 +1,39 @@
1
1
  """CQ World Wide DX CW plugin"""
2
2
 
3
+ # CQ Worldwide DX Contest, CW
4
+ # Status: Active
5
+ # Geographic Focus: Worldwide
6
+ # Participation: Worldwide
7
+ # Awards: Worldwide
8
+ # Mode: CW
9
+ # Bands: 160, 80, 40, 20, 15, 10m
10
+ # Classes: Single Op All Band (QRP/Low/High)
11
+ # Single Op Single Band (QRP/Low/High)
12
+ # Single Op Assisted All Band (QRP/Low/High)
13
+ # Single Op Assisted Single Band (QRP/Low/High)
14
+ # Single Op Overlays: (Classic/Rookie/Youth)
15
+ # Multi-Single (Low/High)
16
+ # Multi-Two
17
+ # Multi-Multi
18
+ # Explorer
19
+ # Max power: HP: 1500 watts
20
+ # LP: 100 watts
21
+ # QRP: 5 watts
22
+ # Exchange: RST + CQ Zone No.
23
+ # Work stations: Once per band
24
+ # QSO Points: 0 points per QSO with same country (counts as mult)
25
+ # 1 point per QSO with different country same continent
26
+ # 2 points per QSO with different country same continent (NA)
27
+ # 3 points per QSO with different continent
28
+ # Multipliers: Each CQ zone once per band
29
+ # Each country once per band
30
+ # Score Calculation: Total score = total QSO points x total mults
31
+ # E-mail logs to: (none)
32
+ # Upload log at: https://www.cqww.com/logcheck/
33
+ # Mail logs to: (none)
34
+ # Find rules at: https://www.cqww.com/rules.htm
35
+ # Cabrillo name: CQ-WW-CW
36
+
3
37
  # pylint: disable=invalid-name, unused-argument, unused-variable, c-extension-no-member, unused-import
4
38
 
5
39
  import datetime