Skip to content

Commit 65e21ad

Browse files
committed
update API Test Functions
add support for update protobuf version setupBLE can create an exe for standalone bluetooth connection on win 11
1 parent 009efb4 commit 65e21ad

File tree

4 files changed

+93
-6
lines changed

4 files changed

+93
-6
lines changed

config.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
DWARF_IP = ""
22
DWARF_ID = ""
33
DWARF_UI = ""
4+
DWARF_UID = ""
45
CLIENT_ID = "0000DAF2-0000-1000-8000-00805F9B34FB"
56
# TIMEOUT_CMD for TimeOut deconnection (s) after not receiving command
67
# none or ommited set by defaut to 30 minutes
78
# set to 0 to remove Timeout : None forced deconnection
89
TIMEOUT_CMD = "0"
910
# LOG_FILE for log file, app.log if ommitted or empty; "False" to redirect to console
10-
LOG_FILE = ""
11+
LOG_FILE = "test_session_Dwarf.log"
1112
# True to add debug level information on log file, if not will be Info Level
12-
DEBUG = "True"
13+
DEBUG = "False"
1314
# True to add info level information on console, if not will be Notice Level
14-
TRACE = "False"
15+
TRACE = "True"

main.py

Lines changed: 76 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
from dwarf_python_api.lib.dwarf_utils import perform_stopAstroWidePhoto
3232
from dwarf_python_api.lib.dwarf_utils import perform_waitEndAstroWidePhoto
3333
from dwarf_python_api.lib.dwarf_utils import perform_update_camera_setting
34+
from dwarf_python_api.lib.dwarf_utils import perform_update_all_camera_setting
3435
from dwarf_python_api.lib.dwarf_utils import perform_get_all_camera_setting
3536
from dwarf_python_api.lib.dwarf_utils import perform_get_all_feature_camera_setting
3637
from dwarf_python_api.lib.dwarf_utils import perform_get_all_camera_wide_setting
@@ -365,6 +366,8 @@ def option_C3():
365366

366367
if matching_entry:
367368
# Extract specific fields for the matching entry
369+
auto_mode = matching_entry["auto_mode"]
370+
print(f"The exposition mode is: {'Manual' if auto_mode else 'Auto'}")
368371
index_value = matching_entry["index"]
369372

370373
camera_exposure = str(get_exposure_name_by_index(index_value,config_to_dwarf_id_str(dwarf_id)))
@@ -479,6 +482,8 @@ def option_C3():
479482

480483
if matching_entry:
481484
# Extract specific fields for the matching entry
485+
auto_mode = matching_entry["auto_mode"]
486+
print(f"The wide exposition mode is: {'Manual' if auto_mode else 'Auto'}")
482487
index_value = matching_entry["index"]
483488

484489
camera_wide_exposure = str(get_wide_exposure_name_by_index(index_value,config_to_dwarf_id_str(dwarf_id)))
@@ -546,7 +551,71 @@ def option_C4():
546551
print("the wide gain is:", camera_wide_gain)
547552
perform_update_camera_setting("wide_gain", camera_wide_gain, config_to_dwarf_id_str(dwarf_id))
548553

549-
554+
def option_CT4():
555+
print("You selected Option CT4. Import Saved Config All Tele Camera all Data into Dwarf")
556+
print("")
557+
# Add your Option CW4 functionality here
558+
# get dwarf type id
559+
data_config = dwarf_python_api.get_config_data.get_config_data()
560+
dwarf_id = data_config['dwarf_id']
561+
dwarf_id_int = config_to_dwarf_id_int(dwarf_id)
562+
print(f"Connected to Dwarf {'Mini' if dwarf_id_int == 5 else dwarf_id_int}")
563+
564+
allValue = {
565+
'camera_exposure': False,
566+
'camera_gain': False,
567+
'camera_ircut': 0,
568+
'camera_wb_mode': 0,
569+
'camera_wb_index_type': 2,
570+
'camera_wb_index': 0,
571+
'camera_brightness': 0,
572+
'camera_contrast': 0,
573+
'camera_saturation': 0,
574+
'camera_sharpness': 50,
575+
'camera_jpg_quality': 80
576+
}
577+
allValue['camera_exposure'] = read_camera_exposure()
578+
if (allValue['camera_exposure']):
579+
print("the wide exposition is: ", allValue['camera_exposure'])
580+
581+
allValue['camera_gain'] = read_camera_gain()
582+
if (allValue['camera_gain']):
583+
print("the wide gain is:", allValue['camera_gain'])
584+
585+
perform_update_all_camera_setting("tele", allValue, config_to_dwarf_id_str(dwarf_id))
586+
587+
def option_CW4():
588+
print("You selected Option CW4. Import Saved Config All Wide Camera all Data into Dwarf")
589+
print("")
590+
# Add your Option CW4 functionality here
591+
# get dwarf type id
592+
data_config = dwarf_python_api.get_config_data.get_config_data()
593+
dwarf_id = data_config['dwarf_id']
594+
dwarf_id_int = config_to_dwarf_id_int(dwarf_id)
595+
print(f"Connected to Dwarf {'Mini' if dwarf_id_int == 5 else dwarf_id_int}")
596+
597+
allValue = {
598+
'camera_exposure': False,
599+
'camera_gain': False,
600+
'camera_ircut': 0,
601+
'camera_wb_mode': 0,
602+
'camera_wb_index_type': 2,
603+
'camera_wb_index': 0,
604+
'camera_brightness': 0,
605+
'camera_contrast': 0,
606+
'camera_saturation': 0,
607+
'camera_sharpness': 50,
608+
'camera_jpg_quality': 80
609+
}
610+
allValue['camera_exposure'] = read_camera_wide_exposure()
611+
if (allValue['camera_exposure']):
612+
print("the wide exposition is: ", allValue['camera_exposure'])
613+
614+
allValue['camera_gain'] = read_camera_wide_gain()
615+
if (allValue['camera_gain']):
616+
print("the wide gain is:", allValue['camera_gain'])
617+
618+
perform_update_all_camera_setting("wide", allValue, config_to_dwarf_id_str(dwarf_id))
550619
def option_C5():
551620
print("You selected Option C5. Start Imaging Session")
552621
print("")
@@ -1416,6 +1485,12 @@ def choice_camera():
14161485
elif user_choice == 'C4':
14171486
option_C4()
14181487

1488+
elif user_choice == 'CT4':
1489+
option_CT4()
1490+
1491+
elif user_choice == 'CW4':
1492+
option_CW4()
1493+
14191494
elif user_choice == 'C5':
14201495
option_C5()
14211496

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
websockets==11.0.3
22

3-
protobuf==3.20.*
3+
protobuf>=4.25.8
44

55
bleak
66

setupBLE.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,22 @@
33

44
# Include additional files and folders
55
buildOptions = dict(
6+
packages = ["asyncio", "bleak", "winrt.windows.foundation.collections"],
7+
includes = [
8+
"winrt.windows.devices.bluetooth",
9+
"winrt.windows.devices.enumeration",
10+
"winrt.windows.foundation",
11+
"winrt.windows.foundation.collections"
12+
],
613
include_files=[
714
('dwarf_ble_connect/','./dwarf_ble_connect'),
8-
]
15+
],
16+
excludes= [],
17+
zip_include_packages= ["*"],
18+
zip_exclude_packages= [],
919
)
1020

21+
1122
# Define the base for a GUI application
1223
base = 'Win32GUI' if sys.platform=='win32' else None
1324
# Setup function

0 commit comments

Comments
 (0)