From 0746acd34f60177f7cc485280e52249ee85ebdfd Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Mon, 15 Aug 2022 19:01:37 -0500 Subject: [PATCH] Canned messages and bluetooth sections --- meshtastic/admin_pb2.py | 12 +-- meshtastic/cannedmessages_pb2.py | 4 +- meshtastic/config_pb2.py | 70 ++++++++++------- meshtastic/localonly_pb2.py | 8 +- meshtastic/node.py | 128 ++++++------------------------- proto | 2 +- 6 files changed, 78 insertions(+), 146 deletions(-) diff --git a/meshtastic/admin_pb2.py b/meshtastic/admin_pb2.py index c4e49bd..7885716 100644 --- a/meshtastic/admin_pb2.py +++ b/meshtastic/admin_pb2.py @@ -19,7 +19,7 @@ from . import mesh_pb2 as mesh__pb2 from . import module_config_pb2 as module__config__pb2 -DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x0b\x61\x64min.proto\x1a\rchannel.proto\x1a\x0c\x63onfig.proto\x1a\x15\x64\x65vice_metadata.proto\x1a\nmesh.proto\x1a\x13module_config.proto\"\xc7\r\n\x0c\x41\x64minMessage\x12\x1a\n\tset_owner\x18\x02 \x01(\x0b\x32\x05.UserH\x00\x12\x1f\n\x0bset_channel\x18\x03 \x01(\x0b\x32\x08.ChannelH\x00\x12\x1d\n\x13get_channel_request\x18\x06 \x01(\rH\x00\x12(\n\x14get_channel_response\x18\x07 \x01(\x0b\x32\x08.ChannelH\x00\x12\x1b\n\x11get_owner_request\x18\x08 \x01(\x08H\x00\x12#\n\x12get_owner_response\x18\t \x01(\x0b\x32\x05.UserH\x00\x12\x36\n\x12get_config_request\x18\n \x01(\x0e\x32\x18.AdminMessage.ConfigTypeH\x00\x12&\n\x13get_config_response\x18\x0b \x01(\x0b\x32\x07.ConfigH\x00\x12\x1d\n\nset_config\x18\x0c \x01(\x0b\x32\x07.ConfigH\x00\x12\x1c\n\x12\x63onfirm_set_config\x18\r \x01(\x08H\x00\x12\x43\n\x19get_module_config_request\x18\x0e \x01(\x0e\x32\x1e.AdminMessage.ModuleConfigTypeH\x00\x12\x33\n\x1aget_module_config_response\x18\x0f \x01(\x0b\x32\r.ModuleConfigH\x00\x12*\n\x11set_module_config\x18\x10 \x01(\x0b\x32\r.ModuleConfigH\x00\x12#\n\x19\x63onfirm_set_module_config\x18\x11 \x01(\x08H\x00\x12!\n\x17get_all_channel_request\x18\x12 \x01(\x08H\x00\x12\x1d\n\x13\x63onfirm_set_channel\x18 \x01(\x08H\x00\x12\x1b\n\x11\x63onfirm_set_radio\x18! \x01(\x08H\x00\x12\x18\n\x0e\x65xit_simulator\x18\" \x01(\x08H\x00\x12\x18\n\x0ereboot_seconds\x18# \x01(\x05H\x00\x12\x31\n\'get_canned_message_module_part1_request\x18$ \x01(\x08H\x00\x12\x32\n(get_canned_message_module_part1_response\x18% \x01(\tH\x00\x12\x31\n\'get_canned_message_module_part2_request\x18& \x01(\x08H\x00\x12\x32\n(get_canned_message_module_part2_response\x18\' \x01(\tH\x00\x12\x31\n\'get_canned_message_module_part3_request\x18( \x01(\x08H\x00\x12\x32\n(get_canned_message_module_part3_response\x18) \x01(\tH\x00\x12\x31\n\'get_canned_message_module_part4_request\x18* \x01(\x08H\x00\x12\x32\n(get_canned_message_module_part4_response\x18+ \x01(\tH\x00\x12)\n\x1fset_canned_message_module_part1\x18, \x01(\tH\x00\x12)\n\x1fset_canned_message_module_part2\x18- \x01(\tH\x00\x12)\n\x1fset_canned_message_module_part3\x18. \x01(\tH\x00\x12)\n\x1fset_canned_message_module_part4\x18/ \x01(\tH\x00\x12\x1a\n\x10shutdown_seconds\x18\x33 \x01(\x05H\x00\x12%\n\x1bget_device_metadata_request\x18\x34 \x01(\rH\x00\x12\x37\n\x1cget_device_metadata_response\x18\x35 \x01(\x0b\x32\x0f.DeviceMetadataH\x00\"|\n\nConfigType\x12\x11\n\rDEVICE_CONFIG\x10\x00\x12\x13\n\x0fPOSITION_CONFIG\x10\x01\x12\x10\n\x0cPOWER_CONFIG\x10\x02\x12\x0f\n\x0bWIFI_CONFIG\x10\x03\x12\x12\n\x0e\x44ISPLAY_CONFIG\x10\x04\x12\x0f\n\x0bLORA_CONFIG\x10\x05\"\xa6\x01\n\x10ModuleConfigType\x12\x0f\n\x0bMQTT_CONFIG\x10\x00\x12\x11\n\rSERIAL_CONFIG\x10\x01\x12\x13\n\x0f\x45XTNOTIF_CONFIG\x10\x02\x12\x17\n\x13STOREFORWARD_CONFIG\x10\x03\x12\x14\n\x10RANGETEST_CONFIG\x10\x04\x12\x14\n\x10TELEMETRY_CONFIG\x10\x05\x12\x14\n\x10\x43\x41NNEDMSG_CONFIG\x10\x06\x42\t\n\x07variantBG\n\x13\x63om.geeksville.meshB\x0b\x41\x64minProtosH\x03Z!github.com/meshtastic/gomeshprotob\x06proto3') +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x0b\x61\x64min.proto\x1a\rchannel.proto\x1a\x0c\x63onfig.proto\x1a\x15\x64\x65vice_metadata.proto\x1a\nmesh.proto\x1a\x13module_config.proto\"\xb1\n\n\x0c\x41\x64minMessage\x12\x1a\n\tset_owner\x18\x02 \x01(\x0b\x32\x05.UserH\x00\x12\x1f\n\x0bset_channel\x18\x03 \x01(\x0b\x32\x08.ChannelH\x00\x12\x1d\n\x13get_channel_request\x18\x06 \x01(\rH\x00\x12(\n\x14get_channel_response\x18\x07 \x01(\x0b\x32\x08.ChannelH\x00\x12\x1b\n\x11get_owner_request\x18\x08 \x01(\x08H\x00\x12#\n\x12get_owner_response\x18\t \x01(\x0b\x32\x05.UserH\x00\x12\x36\n\x12get_config_request\x18\n \x01(\x0e\x32\x18.AdminMessage.ConfigTypeH\x00\x12&\n\x13get_config_response\x18\x0b \x01(\x0b\x32\x07.ConfigH\x00\x12\x1d\n\nset_config\x18\x0c \x01(\x0b\x32\x07.ConfigH\x00\x12\x1c\n\x12\x63onfirm_set_config\x18\r \x01(\x08H\x00\x12\x43\n\x19get_module_config_request\x18\x0e \x01(\x0e\x32\x1e.AdminMessage.ModuleConfigTypeH\x00\x12\x33\n\x1aget_module_config_response\x18\x0f \x01(\x0b\x32\r.ModuleConfigH\x00\x12*\n\x11set_module_config\x18\x10 \x01(\x0b\x32\r.ModuleConfigH\x00\x12#\n\x19\x63onfirm_set_module_config\x18\x11 \x01(\x08H\x00\x12!\n\x17get_all_channel_request\x18\x12 \x01(\x08H\x00\x12\x1d\n\x13\x63onfirm_set_channel\x18 \x01(\x08H\x00\x12\x1b\n\x11\x63onfirm_set_radio\x18! \x01(\x08H\x00\x12\x18\n\x0e\x65xit_simulator\x18\" \x01(\x08H\x00\x12\x18\n\x0ereboot_seconds\x18# \x01(\x05H\x00\x12\x34\n*get_canned_message_module_messages_request\x18$ \x01(\x08H\x00\x12\x35\n+get_canned_message_module_messages_response\x18% \x01(\tH\x00\x12,\n\"set_canned_message_module_messages\x18, \x01(\tH\x00\x12\x1a\n\x10shutdown_seconds\x18\x33 \x01(\x05H\x00\x12%\n\x1bget_device_metadata_request\x18\x34 \x01(\rH\x00\x12\x37\n\x1cget_device_metadata_response\x18\x35 \x01(\x0b\x32\x0f.DeviceMetadataH\x00\"\x92\x01\n\nConfigType\x12\x11\n\rDEVICE_CONFIG\x10\x00\x12\x13\n\x0fPOSITION_CONFIG\x10\x01\x12\x10\n\x0cPOWER_CONFIG\x10\x02\x12\x0f\n\x0bWIFI_CONFIG\x10\x03\x12\x12\n\x0e\x44ISPLAY_CONFIG\x10\x04\x12\x0f\n\x0bLORA_CONFIG\x10\x05\x12\x14\n\x10\x42LUETOOTH_CONFIG\x10\x06\"\xa6\x01\n\x10ModuleConfigType\x12\x0f\n\x0bMQTT_CONFIG\x10\x00\x12\x11\n\rSERIAL_CONFIG\x10\x01\x12\x13\n\x0f\x45XTNOTIF_CONFIG\x10\x02\x12\x17\n\x13STOREFORWARD_CONFIG\x10\x03\x12\x14\n\x10RANGETEST_CONFIG\x10\x04\x12\x14\n\x10TELEMETRY_CONFIG\x10\x05\x12\x14\n\x10\x43\x41NNEDMSG_CONFIG\x10\x06\x42\t\n\x07variantBG\n\x13\x63om.geeksville.meshB\x0b\x41\x64minProtosH\x03Z!github.com/meshtastic/gomeshprotob\x06proto3') @@ -38,9 +38,9 @@ if _descriptor._USE_C_DESCRIPTORS == False: DESCRIPTOR._options = None DESCRIPTOR._serialized_options = b'\n\023com.geeksville.meshB\013AdminProtosH\003Z!github.com/meshtastic/gomeshproto' _ADMINMESSAGE._serialized_start=101 - _ADMINMESSAGE._serialized_end=1836 - _ADMINMESSAGE_CONFIGTYPE._serialized_start=1532 - _ADMINMESSAGE_CONFIGTYPE._serialized_end=1656 - _ADMINMESSAGE_MODULECONFIGTYPE._serialized_start=1659 - _ADMINMESSAGE_MODULECONFIGTYPE._serialized_end=1825 + _ADMINMESSAGE._serialized_end=1430 + _ADMINMESSAGE_CONFIGTYPE._serialized_start=1104 + _ADMINMESSAGE_CONFIGTYPE._serialized_end=1250 + _ADMINMESSAGE_MODULECONFIGTYPE._serialized_start=1253 + _ADMINMESSAGE_MODULECONFIGTYPE._serialized_end=1419 # @@protoc_insertion_point(module_scope) diff --git a/meshtastic/cannedmessages_pb2.py b/meshtastic/cannedmessages_pb2.py index 05458af..d83497c 100644 --- a/meshtastic/cannedmessages_pb2.py +++ b/meshtastic/cannedmessages_pb2.py @@ -14,7 +14,7 @@ _sym_db = _symbol_database.Default() -DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x14\x63\x61nnedmessages.proto\"w\n\x19\x43\x61nnedMessageModuleConfig\x12\x15\n\rmessagesPart1\x18\x0b \x01(\t\x12\x15\n\rmessagesPart2\x18\x0c \x01(\t\x12\x15\n\rmessagesPart3\x18\r \x01(\t\x12\x15\n\rmessagesPart4\x18\x0e \x01(\tBU\n\x13\x63om.geeksville.meshB\x19\x43\x61nnedMessageConfigProtosH\x03Z!github.com/meshtastic/gomeshprotob\x06proto3') +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x14\x63\x61nnedmessages.proto\"-\n\x19\x43\x61nnedMessageModuleConfig\x12\x10\n\x08messages\x18\x01 \x01(\tBU\n\x13\x63om.geeksville.meshB\x19\x43\x61nnedMessageConfigProtosH\x03Z!github.com/meshtastic/gomeshprotob\x06proto3') @@ -31,5 +31,5 @@ if _descriptor._USE_C_DESCRIPTORS == False: DESCRIPTOR._options = None DESCRIPTOR._serialized_options = b'\n\023com.geeksville.meshB\031CannedMessageConfigProtosH\003Z!github.com/meshtastic/gomeshproto' _CANNEDMESSAGEMODULECONFIG._serialized_start=24 - _CANNEDMESSAGEMODULECONFIG._serialized_end=143 + _CANNEDMESSAGEMODULECONFIG._serialized_end=69 # @@protoc_insertion_point(module_scope) diff --git a/meshtastic/config_pb2.py b/meshtastic/config_pb2.py index c822b0f..edf04a2 100644 --- a/meshtastic/config_pb2.py +++ b/meshtastic/config_pb2.py @@ -14,7 +14,7 @@ _sym_db = _symbol_database.Default() -DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x0c\x63onfig.proto\"\xec\x12\n\x06\x43onfig\x12&\n\x06\x64\x65vice\x18\x01 \x01(\x0b\x32\x14.Config.DeviceConfigH\x00\x12*\n\x08position\x18\x02 \x01(\x0b\x32\x16.Config.PositionConfigH\x00\x12$\n\x05power\x18\x03 \x01(\x0b\x32\x13.Config.PowerConfigH\x00\x12\"\n\x04wifi\x18\x04 \x01(\x0b\x32\x12.Config.WiFiConfigH\x00\x12(\n\x07\x64isplay\x18\x05 \x01(\x0b\x32\x15.Config.DisplayConfigH\x00\x12\"\n\x04lora\x18\x06 \x01(\x0b\x32\x12.Config.LoRaConfigH\x00\x1a\xd8\x01\n\x0c\x44\x65viceConfig\x12\'\n\x04role\x18\x01 \x01(\x0e\x32\x19.Config.DeviceConfig.Role\x12\x17\n\x0fserial_disabled\x18\x02 \x01(\x08\x12\x15\n\rfactory_reset\x18\x03 \x01(\x08\x12\x19\n\x11\x64\x65\x62ug_log_enabled\x18\x04 \x01(\x08\x12\x12\n\nntp_server\x18\x05 \x01(\t\"@\n\x04Role\x12\n\n\x06\x43lient\x10\x00\x12\x0e\n\nClientMute\x10\x01\x12\n\n\x06Router\x10\x02\x12\x10\n\x0cRouterClient\x10\x03\x1a\xa8\x03\n\x0ePositionConfig\x12\x1f\n\x17position_broadcast_secs\x18\x01 \x01(\r\x12)\n!position_broadcast_smart_disabled\x18\x02 \x01(\x08\x12\x16\n\x0e\x66ixed_position\x18\x03 \x01(\x08\x12\x14\n\x0cgps_disabled\x18\x05 \x01(\x08\x12\x1b\n\x13gps_update_interval\x18\x06 \x01(\r\x12\x18\n\x10gps_attempt_time\x18\x07 \x01(\r\x12\x16\n\x0eposition_flags\x18\n \x01(\r\"\xcc\x01\n\rPositionFlags\x12\x11\n\rPOS_UNDEFINED\x10\x00\x12\x10\n\x0cPOS_ALTITUDE\x10\x01\x12\x0f\n\x0bPOS_ALT_MSL\x10\x02\x12\x0f\n\x0bPOS_GEO_SEP\x10\x04\x12\x0b\n\x07POS_DOP\x10\x08\x12\r\n\tPOS_HVDOP\x10\x10\x12\x11\n\rPOS_SATINVIEW\x10 \x12\x0f\n\x0bPOS_SEQ_NOS\x10@\x12\x12\n\rPOS_TIMESTAMP\x10\x80\x01\x12\x10\n\x0bPOS_HEADING\x10\x80\x02\x12\x0e\n\tPOS_SPEED\x10\x80\x04\x1a\xf4\x03\n\x0bPowerConfig\x12\x39\n\x0e\x63harge_current\x18\x01 \x01(\x0e\x32!.Config.PowerConfig.ChargeCurrent\x12\x17\n\x0fis_power_saving\x18\x02 \x01(\x08\x12&\n\x1eon_battery_shutdown_after_secs\x18\x04 \x01(\r\x12\x1f\n\x17\x61\x64\x63_multiplier_override\x18\x06 \x01(\x02\x12\x1b\n\x13wait_bluetooth_secs\x18\x07 \x01(\r\x12\x1d\n\x15mesh_sds_timeout_secs\x18\t \x01(\r\x12\x10\n\x08sds_secs\x18\n \x01(\r\x12\x0f\n\x07ls_secs\x18\x0b \x01(\r\x12\x15\n\rmin_wake_secs\x18\x0c \x01(\r\"\xd1\x01\n\rChargeCurrent\x12\x0b\n\x07MAUnset\x10\x00\x12\t\n\x05MA100\x10\x01\x12\t\n\x05MA190\x10\x02\x12\t\n\x05MA280\x10\x03\x12\t\n\x05MA360\x10\x04\x12\t\n\x05MA450\x10\x05\x12\t\n\x05MA550\x10\x06\x12\t\n\x05MA630\x10\x07\x12\t\n\x05MA700\x10\x08\x12\t\n\x05MA780\x10\t\x12\t\n\x05MA880\x10\n\x12\t\n\x05MA960\x10\x0b\x12\n\n\x06MA1000\x10\x0c\x12\n\n\x06MA1080\x10\r\x12\n\n\x06MA1160\x10\x0e\x12\n\n\x06MA1240\x10\x0f\x12\n\n\x06MA1320\x10\x10\x1a\xa3\x01\n\nWiFiConfig\x12\x0f\n\x07\x65nabled\x18\x01 \x01(\x08\x12)\n\x04mode\x18\x02 \x01(\x0e\x32\x1b.Config.WiFiConfig.WiFiMode\x12\x0c\n\x04ssid\x18\x03 \x01(\t\x12\x0b\n\x03psk\x18\x04 \x01(\t\">\n\x08WiFiMode\x12\n\n\x06\x43lient\x10\x00\x12\x0f\n\x0b\x41\x63\x63\x65ssPoint\x10\x01\x12\x15\n\x11\x41\x63\x63\x65ssPointHidden\x10\x02\x1a\xaa\x02\n\rDisplayConfig\x12\x16\n\x0escreen_on_secs\x18\x01 \x01(\r\x12=\n\ngps_format\x18\x02 \x01(\x0e\x32).Config.DisplayConfig.GpsCoordinateFormat\x12!\n\x19\x61uto_screen_carousel_secs\x18\x03 \x01(\r\x12\x19\n\x11\x63ompass_north_top\x18\x04 \x01(\x08\"\x83\x01\n\x13GpsCoordinateFormat\x12\x10\n\x0cGpsFormatDec\x10\x00\x12\x10\n\x0cGpsFormatDMS\x10\x01\x12\x10\n\x0cGpsFormatUTM\x10\x02\x12\x11\n\rGpsFormatMGRS\x10\x03\x12\x10\n\x0cGpsFormatOLC\x10\x04\x12\x11\n\rGpsFormatOSGR\x10\x05\x1a\x93\x04\n\nLoRaConfig\x12\x10\n\x08tx_power\x18\x01 \x01(\x05\x12\x34\n\x0cmodem_preset\x18\x02 \x01(\x0e\x32\x1e.Config.LoRaConfig.ModemPreset\x12\x11\n\tbandwidth\x18\x03 \x01(\r\x12\x15\n\rspread_factor\x18\x04 \x01(\r\x12\x13\n\x0b\x63oding_rate\x18\x05 \x01(\r\x12\x18\n\x10\x66requency_offset\x18\x06 \x01(\x02\x12-\n\x06region\x18\x07 \x01(\x0e\x32\x1d.Config.LoRaConfig.RegionCode\x12\x11\n\thop_limit\x18\x08 \x01(\r\x12\x13\n\x0btx_disabled\x18\t \x01(\x08\x12\x17\n\x0fignore_incoming\x18g \x03(\r\"\x81\x01\n\nRegionCode\x12\t\n\x05Unset\x10\x00\x12\x06\n\x02US\x10\x01\x12\t\n\x05\x45U433\x10\x02\x12\t\n\x05\x45U868\x10\x03\x12\x06\n\x02\x43N\x10\x04\x12\x06\n\x02JP\x10\x05\x12\x07\n\x03\x41NZ\x10\x06\x12\x06\n\x02KR\x10\x07\x12\x06\n\x02TW\x10\x08\x12\x06\n\x02RU\x10\t\x12\x06\n\x02IN\x10\n\x12\t\n\x05NZ865\x10\x0b\x12\x06\n\x02TH\x10\x0c\"p\n\x0bModemPreset\x12\x0c\n\x08LongFast\x10\x00\x12\x0c\n\x08LongSlow\x10\x01\x12\r\n\tVLongSlow\x10\x02\x12\x0b\n\x07MedSlow\x10\x03\x12\x0b\n\x07MedFast\x10\x04\x12\r\n\tShortSlow\x10\x05\x12\r\n\tShortFast\x10\x06\x42\x10\n\x0epayloadVariantBH\n\x13\x63om.geeksville.meshB\x0c\x43onfigProtosH\x03Z!github.com/meshtastic/gomeshprotob\x06proto3') +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x0c\x63onfig.proto\"\xbc\x14\n\x06\x43onfig\x12&\n\x06\x64\x65vice\x18\x01 \x01(\x0b\x32\x14.Config.DeviceConfigH\x00\x12*\n\x08position\x18\x02 \x01(\x0b\x32\x16.Config.PositionConfigH\x00\x12$\n\x05power\x18\x03 \x01(\x0b\x32\x13.Config.PowerConfigH\x00\x12\"\n\x04wifi\x18\x04 \x01(\x0b\x32\x12.Config.WiFiConfigH\x00\x12(\n\x07\x64isplay\x18\x05 \x01(\x0b\x32\x15.Config.DisplayConfigH\x00\x12\"\n\x04lora\x18\x06 \x01(\x0b\x32\x12.Config.LoRaConfigH\x00\x12,\n\tbluetooth\x18\x07 \x01(\x0b\x32\x17.Config.BluetoothConfigH\x00\x1a\xd8\x01\n\x0c\x44\x65viceConfig\x12\'\n\x04role\x18\x01 \x01(\x0e\x32\x19.Config.DeviceConfig.Role\x12\x17\n\x0fserial_disabled\x18\x02 \x01(\x08\x12\x15\n\rfactory_reset\x18\x03 \x01(\x08\x12\x19\n\x11\x64\x65\x62ug_log_enabled\x18\x04 \x01(\x08\x12\x12\n\nntp_server\x18\x05 \x01(\t\"@\n\x04Role\x12\n\n\x06\x43lient\x10\x00\x12\x0e\n\nClientMute\x10\x01\x12\n\n\x06Router\x10\x02\x12\x10\n\x0cRouterClient\x10\x03\x1a\xa8\x03\n\x0ePositionConfig\x12\x1f\n\x17position_broadcast_secs\x18\x01 \x01(\r\x12)\n!position_broadcast_smart_disabled\x18\x02 \x01(\x08\x12\x16\n\x0e\x66ixed_position\x18\x03 \x01(\x08\x12\x14\n\x0cgps_disabled\x18\x05 \x01(\x08\x12\x1b\n\x13gps_update_interval\x18\x06 \x01(\r\x12\x18\n\x10gps_attempt_time\x18\x07 \x01(\r\x12\x16\n\x0eposition_flags\x18\n \x01(\r\"\xcc\x01\n\rPositionFlags\x12\x11\n\rPOS_UNDEFINED\x10\x00\x12\x10\n\x0cPOS_ALTITUDE\x10\x01\x12\x0f\n\x0bPOS_ALT_MSL\x10\x02\x12\x0f\n\x0bPOS_GEO_SEP\x10\x04\x12\x0b\n\x07POS_DOP\x10\x08\x12\r\n\tPOS_HVDOP\x10\x10\x12\x11\n\rPOS_SATINVIEW\x10 \x12\x0f\n\x0bPOS_SEQ_NOS\x10@\x12\x12\n\rPOS_TIMESTAMP\x10\x80\x01\x12\x10\n\x0bPOS_HEADING\x10\x80\x02\x12\x0e\n\tPOS_SPEED\x10\x80\x04\x1a\xf4\x03\n\x0bPowerConfig\x12\x39\n\x0e\x63harge_current\x18\x01 \x01(\x0e\x32!.Config.PowerConfig.ChargeCurrent\x12\x17\n\x0fis_power_saving\x18\x02 \x01(\x08\x12&\n\x1eon_battery_shutdown_after_secs\x18\x04 \x01(\r\x12\x1f\n\x17\x61\x64\x63_multiplier_override\x18\x06 \x01(\x02\x12\x1b\n\x13wait_bluetooth_secs\x18\x07 \x01(\r\x12\x1d\n\x15mesh_sds_timeout_secs\x18\t \x01(\r\x12\x10\n\x08sds_secs\x18\n \x01(\r\x12\x0f\n\x07ls_secs\x18\x0b \x01(\r\x12\x15\n\rmin_wake_secs\x18\x0c \x01(\r\"\xd1\x01\n\rChargeCurrent\x12\x0b\n\x07MAUnset\x10\x00\x12\t\n\x05MA100\x10\x01\x12\t\n\x05MA190\x10\x02\x12\t\n\x05MA280\x10\x03\x12\t\n\x05MA360\x10\x04\x12\t\n\x05MA450\x10\x05\x12\t\n\x05MA550\x10\x06\x12\t\n\x05MA630\x10\x07\x12\t\n\x05MA700\x10\x08\x12\t\n\x05MA780\x10\t\x12\t\n\x05MA880\x10\n\x12\t\n\x05MA960\x10\x0b\x12\n\n\x06MA1000\x10\x0c\x12\n\n\x06MA1080\x10\r\x12\n\n\x06MA1160\x10\x0e\x12\n\n\x06MA1240\x10\x0f\x12\n\n\x06MA1320\x10\x10\x1a\xa3\x01\n\nWiFiConfig\x12\x0f\n\x07\x65nabled\x18\x01 \x01(\x08\x12)\n\x04mode\x18\x02 \x01(\x0e\x32\x1b.Config.WiFiConfig.WiFiMode\x12\x0c\n\x04ssid\x18\x03 \x01(\t\x12\x0b\n\x03psk\x18\x04 \x01(\t\">\n\x08WiFiMode\x12\n\n\x06\x43lient\x10\x00\x12\x0f\n\x0b\x41\x63\x63\x65ssPoint\x10\x01\x12\x15\n\x11\x41\x63\x63\x65ssPointHidden\x10\x02\x1a\xaa\x02\n\rDisplayConfig\x12\x16\n\x0escreen_on_secs\x18\x01 \x01(\r\x12=\n\ngps_format\x18\x02 \x01(\x0e\x32).Config.DisplayConfig.GpsCoordinateFormat\x12!\n\x19\x61uto_screen_carousel_secs\x18\x03 \x01(\r\x12\x19\n\x11\x63ompass_north_top\x18\x04 \x01(\x08\"\x83\x01\n\x13GpsCoordinateFormat\x12\x10\n\x0cGpsFormatDec\x10\x00\x12\x10\n\x0cGpsFormatDMS\x10\x01\x12\x10\n\x0cGpsFormatUTM\x10\x02\x12\x11\n\rGpsFormatMGRS\x10\x03\x12\x10\n\x0cGpsFormatOLC\x10\x04\x12\x11\n\rGpsFormatOSGR\x10\x05\x1a\x93\x04\n\nLoRaConfig\x12\x10\n\x08tx_power\x18\x01 \x01(\x05\x12\x34\n\x0cmodem_preset\x18\x02 \x01(\x0e\x32\x1e.Config.LoRaConfig.ModemPreset\x12\x11\n\tbandwidth\x18\x03 \x01(\r\x12\x15\n\rspread_factor\x18\x04 \x01(\r\x12\x13\n\x0b\x63oding_rate\x18\x05 \x01(\r\x12\x18\n\x10\x66requency_offset\x18\x06 \x01(\x02\x12-\n\x06region\x18\x07 \x01(\x0e\x32\x1d.Config.LoRaConfig.RegionCode\x12\x11\n\thop_limit\x18\x08 \x01(\r\x12\x13\n\x0btx_disabled\x18\t \x01(\x08\x12\x17\n\x0fignore_incoming\x18g \x03(\r\"\x81\x01\n\nRegionCode\x12\t\n\x05Unset\x10\x00\x12\x06\n\x02US\x10\x01\x12\t\n\x05\x45U433\x10\x02\x12\t\n\x05\x45U868\x10\x03\x12\x06\n\x02\x43N\x10\x04\x12\x06\n\x02JP\x10\x05\x12\x07\n\x03\x41NZ\x10\x06\x12\x06\n\x02KR\x10\x07\x12\x06\n\x02TW\x10\x08\x12\x06\n\x02RU\x10\t\x12\x06\n\x02IN\x10\n\x12\t\n\x05NZ865\x10\x0b\x12\x06\n\x02TH\x10\x0c\"p\n\x0bModemPreset\x12\x0c\n\x08LongFast\x10\x00\x12\x0c\n\x08LongSlow\x10\x01\x12\r\n\tVLongSlow\x10\x02\x12\x0b\n\x07MedSlow\x10\x03\x12\x0b\n\x07MedFast\x10\x04\x12\r\n\tShortSlow\x10\x05\x12\r\n\tShortFast\x10\x06\x1a\x9f\x01\n\x0f\x42luetoothConfig\x12\x0f\n\x07\x65nabled\x18\x01 \x01(\x08\x12\x31\n\x04mode\x18\x02 \x01(\x0e\x32#.Config.BluetoothConfig.PairingMode\x12\x11\n\tfixed_pin\x18\x03 \x01(\r\"5\n\x0bPairingMode\x12\r\n\tRandomPin\x10\x00\x12\x0c\n\x08\x46ixedPin\x10\x01\x12\t\n\x05NoPin\x10\x02\x42\x10\n\x0epayloadVariantBH\n\x13\x63om.geeksville.meshB\x0c\x43onfigProtosH\x03Z!github.com/meshtastic/gomeshprotob\x06proto3') @@ -25,6 +25,7 @@ _CONFIG_POWERCONFIG = _CONFIG.nested_types_by_name['PowerConfig'] _CONFIG_WIFICONFIG = _CONFIG.nested_types_by_name['WiFiConfig'] _CONFIG_DISPLAYCONFIG = _CONFIG.nested_types_by_name['DisplayConfig'] _CONFIG_LORACONFIG = _CONFIG.nested_types_by_name['LoRaConfig'] +_CONFIG_BLUETOOTHCONFIG = _CONFIG.nested_types_by_name['BluetoothConfig'] _CONFIG_DEVICECONFIG_ROLE = _CONFIG_DEVICECONFIG.enum_types_by_name['Role'] _CONFIG_POSITIONCONFIG_POSITIONFLAGS = _CONFIG_POSITIONCONFIG.enum_types_by_name['PositionFlags'] _CONFIG_POWERCONFIG_CHARGECURRENT = _CONFIG_POWERCONFIG.enum_types_by_name['ChargeCurrent'] @@ -32,6 +33,7 @@ _CONFIG_WIFICONFIG_WIFIMODE = _CONFIG_WIFICONFIG.enum_types_by_name['WiFiMode'] _CONFIG_DISPLAYCONFIG_GPSCOORDINATEFORMAT = _CONFIG_DISPLAYCONFIG.enum_types_by_name['GpsCoordinateFormat'] _CONFIG_LORACONFIG_REGIONCODE = _CONFIG_LORACONFIG.enum_types_by_name['RegionCode'] _CONFIG_LORACONFIG_MODEMPRESET = _CONFIG_LORACONFIG.enum_types_by_name['ModemPreset'] +_CONFIG_BLUETOOTHCONFIG_PAIRINGMODE = _CONFIG_BLUETOOTHCONFIG.enum_types_by_name['PairingMode'] Config = _reflection.GeneratedProtocolMessageType('Config', (_message.Message,), { 'DeviceConfig' : _reflection.GeneratedProtocolMessageType('DeviceConfig', (_message.Message,), { @@ -75,6 +77,13 @@ Config = _reflection.GeneratedProtocolMessageType('Config', (_message.Message,), # @@protoc_insertion_point(class_scope:Config.LoRaConfig) }) , + + 'BluetoothConfig' : _reflection.GeneratedProtocolMessageType('BluetoothConfig', (_message.Message,), { + 'DESCRIPTOR' : _CONFIG_BLUETOOTHCONFIG, + '__module__' : 'config_pb2' + # @@protoc_insertion_point(class_scope:Config.BluetoothConfig) + }) + , 'DESCRIPTOR' : _CONFIG, '__module__' : 'config_pb2' # @@protoc_insertion_point(class_scope:Config) @@ -86,37 +95,42 @@ _sym_db.RegisterMessage(Config.PowerConfig) _sym_db.RegisterMessage(Config.WiFiConfig) _sym_db.RegisterMessage(Config.DisplayConfig) _sym_db.RegisterMessage(Config.LoRaConfig) +_sym_db.RegisterMessage(Config.BluetoothConfig) if _descriptor._USE_C_DESCRIPTORS == False: DESCRIPTOR._options = None DESCRIPTOR._serialized_options = b'\n\023com.geeksville.meshB\014ConfigProtosH\003Z!github.com/meshtastic/gomeshproto' _CONFIG._serialized_start=17 - _CONFIG._serialized_end=2429 - _CONFIG_DEVICECONFIG._serialized_start=264 - _CONFIG_DEVICECONFIG._serialized_end=480 - _CONFIG_DEVICECONFIG_ROLE._serialized_start=416 - _CONFIG_DEVICECONFIG_ROLE._serialized_end=480 - _CONFIG_POSITIONCONFIG._serialized_start=483 - _CONFIG_POSITIONCONFIG._serialized_end=907 - _CONFIG_POSITIONCONFIG_POSITIONFLAGS._serialized_start=703 - _CONFIG_POSITIONCONFIG_POSITIONFLAGS._serialized_end=907 - _CONFIG_POWERCONFIG._serialized_start=910 - _CONFIG_POWERCONFIG._serialized_end=1410 - _CONFIG_POWERCONFIG_CHARGECURRENT._serialized_start=1201 - _CONFIG_POWERCONFIG_CHARGECURRENT._serialized_end=1410 - _CONFIG_WIFICONFIG._serialized_start=1413 - _CONFIG_WIFICONFIG._serialized_end=1576 - _CONFIG_WIFICONFIG_WIFIMODE._serialized_start=1514 - _CONFIG_WIFICONFIG_WIFIMODE._serialized_end=1576 - _CONFIG_DISPLAYCONFIG._serialized_start=1579 - _CONFIG_DISPLAYCONFIG._serialized_end=1877 - _CONFIG_DISPLAYCONFIG_GPSCOORDINATEFORMAT._serialized_start=1746 - _CONFIG_DISPLAYCONFIG_GPSCOORDINATEFORMAT._serialized_end=1877 - _CONFIG_LORACONFIG._serialized_start=1880 - _CONFIG_LORACONFIG._serialized_end=2411 - _CONFIG_LORACONFIG_REGIONCODE._serialized_start=2168 - _CONFIG_LORACONFIG_REGIONCODE._serialized_end=2297 - _CONFIG_LORACONFIG_MODEMPRESET._serialized_start=2299 - _CONFIG_LORACONFIG_MODEMPRESET._serialized_end=2411 + _CONFIG._serialized_end=2637 + _CONFIG_DEVICECONFIG._serialized_start=310 + _CONFIG_DEVICECONFIG._serialized_end=526 + _CONFIG_DEVICECONFIG_ROLE._serialized_start=462 + _CONFIG_DEVICECONFIG_ROLE._serialized_end=526 + _CONFIG_POSITIONCONFIG._serialized_start=529 + _CONFIG_POSITIONCONFIG._serialized_end=953 + _CONFIG_POSITIONCONFIG_POSITIONFLAGS._serialized_start=749 + _CONFIG_POSITIONCONFIG_POSITIONFLAGS._serialized_end=953 + _CONFIG_POWERCONFIG._serialized_start=956 + _CONFIG_POWERCONFIG._serialized_end=1456 + _CONFIG_POWERCONFIG_CHARGECURRENT._serialized_start=1247 + _CONFIG_POWERCONFIG_CHARGECURRENT._serialized_end=1456 + _CONFIG_WIFICONFIG._serialized_start=1459 + _CONFIG_WIFICONFIG._serialized_end=1622 + _CONFIG_WIFICONFIG_WIFIMODE._serialized_start=1560 + _CONFIG_WIFICONFIG_WIFIMODE._serialized_end=1622 + _CONFIG_DISPLAYCONFIG._serialized_start=1625 + _CONFIG_DISPLAYCONFIG._serialized_end=1923 + _CONFIG_DISPLAYCONFIG_GPSCOORDINATEFORMAT._serialized_start=1792 + _CONFIG_DISPLAYCONFIG_GPSCOORDINATEFORMAT._serialized_end=1923 + _CONFIG_LORACONFIG._serialized_start=1926 + _CONFIG_LORACONFIG._serialized_end=2457 + _CONFIG_LORACONFIG_REGIONCODE._serialized_start=2214 + _CONFIG_LORACONFIG_REGIONCODE._serialized_end=2343 + _CONFIG_LORACONFIG_MODEMPRESET._serialized_start=2345 + _CONFIG_LORACONFIG_MODEMPRESET._serialized_end=2457 + _CONFIG_BLUETOOTHCONFIG._serialized_start=2460 + _CONFIG_BLUETOOTHCONFIG._serialized_end=2619 + _CONFIG_BLUETOOTHCONFIG_PAIRINGMODE._serialized_start=2566 + _CONFIG_BLUETOOTHCONFIG_PAIRINGMODE._serialized_end=2619 # @@protoc_insertion_point(module_scope) diff --git a/meshtastic/localonly_pb2.py b/meshtastic/localonly_pb2.py index b5dffe4..94f0dd7 100644 --- a/meshtastic/localonly_pb2.py +++ b/meshtastic/localonly_pb2.py @@ -16,7 +16,7 @@ from . import config_pb2 as config__pb2 from . import module_config_pb2 as module__config__pb2 -DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x0flocalonly.proto\x1a\x0c\x63onfig.proto\x1a\x13module_config.proto\"\xfe\x01\n\x0bLocalConfig\x12$\n\x06\x64\x65vice\x18\x01 \x01(\x0b\x32\x14.Config.DeviceConfig\x12(\n\x08position\x18\x02 \x01(\x0b\x32\x16.Config.PositionConfig\x12\"\n\x05power\x18\x03 \x01(\x0b\x32\x13.Config.PowerConfig\x12 \n\x04wifi\x18\x04 \x01(\x0b\x32\x12.Config.WiFiConfig\x12&\n\x07\x64isplay\x18\x05 \x01(\x0b\x32\x15.Config.DisplayConfig\x12 \n\x04lora\x18\x06 \x01(\x0b\x32\x12.Config.LoRaConfig\x12\x0f\n\x07version\x18\x07 \x01(\r\"\x9a\x03\n\x11LocalModuleConfig\x12&\n\x04mqtt\x18\x01 \x01(\x0b\x32\x18.ModuleConfig.MQTTConfig\x12*\n\x06serial\x18\x02 \x01(\x0b\x32\x1a.ModuleConfig.SerialConfig\x12G\n\x15\x65xternal_notification\x18\x03 \x01(\x0b\x32(.ModuleConfig.ExternalNotificationConfig\x12\x37\n\rstore_forward\x18\x04 \x01(\x0b\x32 .ModuleConfig.StoreForwardConfig\x12\x31\n\nrange_test\x18\x05 \x01(\x0b\x32\x1d.ModuleConfig.RangeTestConfig\x12\x30\n\ttelemetry\x18\x06 \x01(\x0b\x32\x1d.ModuleConfig.TelemetryConfig\x12\x39\n\x0e\x63\x61nned_message\x18\x07 \x01(\x0b\x32!.ModuleConfig.CannedMessageConfig\x12\x0f\n\x07version\x18\x08 \x01(\rBK\n\x13\x63om.geeksville.meshB\x0fLocalOnlyProtosH\x03Z!github.com/meshtastic/gomeshprotob\x06proto3') +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x0flocalonly.proto\x1a\x0c\x63onfig.proto\x1a\x13module_config.proto\"\xaa\x02\n\x0bLocalConfig\x12$\n\x06\x64\x65vice\x18\x01 \x01(\x0b\x32\x14.Config.DeviceConfig\x12(\n\x08position\x18\x02 \x01(\x0b\x32\x16.Config.PositionConfig\x12\"\n\x05power\x18\x03 \x01(\x0b\x32\x13.Config.PowerConfig\x12 \n\x04wifi\x18\x04 \x01(\x0b\x32\x12.Config.WiFiConfig\x12&\n\x07\x64isplay\x18\x05 \x01(\x0b\x32\x15.Config.DisplayConfig\x12 \n\x04lora\x18\x06 \x01(\x0b\x32\x12.Config.LoRaConfig\x12*\n\tbluetooth\x18\x07 \x01(\x0b\x32\x17.Config.BluetoothConfig\x12\x0f\n\x07version\x18\x08 \x01(\r\"\x9a\x03\n\x11LocalModuleConfig\x12&\n\x04mqtt\x18\x01 \x01(\x0b\x32\x18.ModuleConfig.MQTTConfig\x12*\n\x06serial\x18\x02 \x01(\x0b\x32\x1a.ModuleConfig.SerialConfig\x12G\n\x15\x65xternal_notification\x18\x03 \x01(\x0b\x32(.ModuleConfig.ExternalNotificationConfig\x12\x37\n\rstore_forward\x18\x04 \x01(\x0b\x32 .ModuleConfig.StoreForwardConfig\x12\x31\n\nrange_test\x18\x05 \x01(\x0b\x32\x1d.ModuleConfig.RangeTestConfig\x12\x30\n\ttelemetry\x18\x06 \x01(\x0b\x32\x1d.ModuleConfig.TelemetryConfig\x12\x39\n\x0e\x63\x61nned_message\x18\x07 \x01(\x0b\x32!.ModuleConfig.CannedMessageConfig\x12\x0f\n\x07version\x18\x08 \x01(\rBK\n\x13\x63om.geeksville.meshB\x0fLocalOnlyProtosH\x03Z!github.com/meshtastic/gomeshprotob\x06proto3') @@ -41,7 +41,7 @@ if _descriptor._USE_C_DESCRIPTORS == False: DESCRIPTOR._options = None DESCRIPTOR._serialized_options = b'\n\023com.geeksville.meshB\017LocalOnlyProtosH\003Z!github.com/meshtastic/gomeshproto' _LOCALCONFIG._serialized_start=55 - _LOCALCONFIG._serialized_end=309 - _LOCALMODULECONFIG._serialized_start=312 - _LOCALMODULECONFIG._serialized_end=722 + _LOCALCONFIG._serialized_end=353 + _LOCALMODULECONFIG._serialized_start=356 + _LOCALMODULECONFIG._serialized_end=766 # @@protoc_insertion_point(module_scope) diff --git a/meshtastic/node.py b/meshtastic/node.py index 70a0ac0..789d16f 100644 --- a/meshtastic/node.py +++ b/meshtastic/node.py @@ -25,13 +25,9 @@ class Node: self._timeout = Timeout(maxSecs=300) self.partialChannels = None self.noProto = noProto - self.cannedPluginMessage = None - self.cannedPluginMessagePart1 = None - self.cannedPluginMessagePart2 = None - self.cannedPluginMessagePart3 = None - self.cannedPluginMessagePart4 = None + self.cannedPluginMessageMessages = None self.gotResponse = None @@ -129,6 +125,13 @@ class Node: logging.debug("Wrote lora") time.sleep(0.3) + if self.localConfig.bluetooth: + p = admin_pb2.AdminMessage() + p.set_config.lora.CopyFrom(self.localConfig.bluetooth) + self._sendAdmin(p) + logging.debug("Wrote bluetooth") + time.sleep(0.3) + if self.moduleConfig.mqtt: p = admin_pb2.AdminMessage() p.set_module_config.mqtt.CopyFrom(self.moduleConfig.mqtt) @@ -197,6 +200,8 @@ class Node: p.set_config.display.CopyFrom(self.localConfig.display) elif config_name == 'lora': p.set_config.lora.CopyFrom(self.localConfig.lora) + elif config_name == 'bluetooth': + p.set_config.bluetooth.CopyFrom(self.localConfig.bluetooth) elif config_name == 'mqtt': p.set_module_config.mqtt.CopyFrom(self.moduleConfig.mqtt) elif config_name == 'serial': @@ -366,9 +371,9 @@ class Node: self.writeChannel(ch.index) i = i + 1 - def onResponseRequestCannedMessagePluginMessagePart1(self, p): + def onResponseRequestCannedMessagePluginMessageMessages(self, p): """Handle the response packet for requesting canned message plugin message part 1""" - logging.debug(f'onResponseRequestCannedMessagePluginMessagePart1() p:{p}') + logging.debug(f'onResponseRequestCannedMessagePluginMessageMessages() p:{p}') errorFound = False if "routing" in p["decoded"]: if p["decoded"]["routing"]["errorReason"] != "NONE": @@ -378,57 +383,10 @@ class Node: if "decoded" in p: if "admin" in p["decoded"]: if "raw" in p["decoded"]["admin"]: - self.cannedPluginMessagePart1 = p["decoded"]["admin"]["raw"].get_canned_message_module_part1_response - logging.debug(f'self.cannedPluginMessagePart1:{self.cannedPluginMessagePart1}') + self.cannedPluginMessageMessages = p["decoded"]["admin"]["raw"].get_canned_message_module_messages_response + logging.debug(f'self.cannedPluginMessageMessages:{self.cannedPluginMessageMessages}') self.gotResponse = True - def onResponseRequestCannedMessagePluginMessagePart2(self, p): - """Handle the response packet for requesting canned message plugin message part 2""" - logging.debug(f'onResponseRequestCannedMessagePluginMessagePart2() p:{p}') - errorFound = False - if "routing" in p["decoded"]: - if p["decoded"]["routing"]["errorReason"] != "NONE": - errorFound = True - print(f'Error on response: {p["decoded"]["routing"]["errorReason"]}') - if errorFound is False: - if "decoded" in p: - if "admin" in p["decoded"]: - if "raw" in p["decoded"]["admin"]: - self.cannedPluginMessagePart2 = p["decoded"]["admin"]["raw"].get_canned_message_module_part2_response - logging.debug(f'self.cannedPluginMessagePart2:{self.cannedPluginMessagePart2}') - self.gotResponse = True - - def onResponseRequestCannedMessagePluginMessagePart3(self, p): - """Handle the response packet for requesting canned message plugin message part 3""" - logging.debug(f'onResponseRequestCannedMessagePluginMessagePart3() p:{p}') - errorFound = False - if "routing" in p["decoded"]: - if p["decoded"]["routing"]["errorReason"] != "NONE": - errorFound = True - print(f'Error on response: {p["decoded"]["routing"]["errorReason"]}') - if errorFound is False: - if "decoded" in p: - if "admin" in p["decoded"]: - if "raw" in p["decoded"]["admin"]: - self.cannedPluginMessagePart3 = p["decoded"]["admin"]["raw"].get_canned_message_module_part3_response - logging.debug(f'self.cannedPluginMessagePart3:{self.cannedPluginMessagePart3}') - self.gotResponse = True - - def onResponseRequestCannedMessagePluginMessagePart4(self, p): - """Handle the response packet for requesting canned message plugin message part 4""" - logging.debug(f'onResponseRequestCannedMessagePluginMessagePart4() p:{p}') - errorFound = False - if "routing" in p["decoded"]: - if p["decoded"]["routing"]["errorReason"] != "NONE": - errorFound = True - print(f'Error on response: {p["decoded"]["routing"]["errorReason"]}') - if errorFound is False: - if "decoded" in p: - if "admin" in p["decoded"]: - if "raw" in p["decoded"]["admin"]: - self.cannedPluginMessagePart4 = p["decoded"]["admin"]["raw"].get_canned_message_module_part4_response - logging.debug(f'self.cannedPluginMessagePart4:{self.cannedPluginMessagePart4}') - self.gotResponse = True def get_canned_message(self): """Get the canned message string. Concatenate all pieces together and return a single string.""" @@ -436,61 +394,27 @@ class Node: if not self.cannedPluginMessage: p1 = admin_pb2.AdminMessage() - p1.get_canned_message_module_part1_request = True + p1.get_canned_message_module_messages_request = True self.gotResponse = False - self._sendAdmin(p1, wantResponse=True, onResponse=self.onResponseRequestCannedMessagePluginMessagePart1) + self._sendAdmin(p1, wantResponse=True, onResponse=self.onResponseRequestCannedMessagePluginMessageMessages) while self.gotResponse is False: time.sleep(0.1) - p2 = admin_pb2.AdminMessage() - p2.get_canned_message_module_part2_request = True - self.gotResponse = False - self._sendAdmin(p2, wantResponse=True, onResponse=self.onResponseRequestCannedMessagePluginMessagePart2) - while self.gotResponse is False: - time.sleep(0.1) - - p3 = admin_pb2.AdminMessage() - p3.get_canned_message_module_part3_request = True - self.gotResponse = False - self._sendAdmin(p3, wantResponse=True, onResponse=self.onResponseRequestCannedMessagePluginMessagePart3) - while self.gotResponse is False: - time.sleep(0.1) - - p4 = admin_pb2.AdminMessage() - p4.get_canned_message_module_part4_request = True - self.gotResponse = False - self._sendAdmin(p4, wantResponse=True, onResponse=self.onResponseRequestCannedMessagePluginMessagePart4) - while self.gotResponse is False: - time.sleep(0.1) - - # TODO: This feels wrong to have a sleep here. Is there a way to ensure that - # all requests are complete? Perhaps change to a while loop any parts are None... maybe? - time.sleep(3) - - logging.debug(f'self.cannedPluginMessagePart1:{self.cannedPluginMessagePart1}') - logging.debug(f'self.cannedPluginMessagePart2:{self.cannedPluginMessagePart2}') - logging.debug(f'self.cannedPluginMessagePart3:{self.cannedPluginMessagePart3}') - logging.debug(f'self.cannedPluginMessagePart4:{self.cannedPluginMessagePart4}') + logging.debug(f'self.cannedPluginMessageMessages:{self.cannedPluginMessageMessages}') self.cannedPluginMessage = "" - if self.cannedPluginMessagePart1: - self.cannedPluginMessage += self.cannedPluginMessagePart1 - if self.cannedPluginMessagePart2: - self.cannedPluginMessage += self.cannedPluginMessagePart2 - if self.cannedPluginMessagePart3: - self.cannedPluginMessage += self.cannedPluginMessagePart3 - if self.cannedPluginMessagePart4: - self.cannedPluginMessage += self.cannedPluginMessagePart4 + if self.cannedPluginMessageMessages: + self.cannedPluginMessage += self.cannedPluginMessageMessages print(f'canned_plugin_message:{self.cannedPluginMessage}') logging.debug(f'canned_plugin_message:{self.cannedPluginMessage}') return self.cannedPluginMessage def set_canned_message(self, message): - """Set the canned message. Split into parts of 200 chars each.""" + """Set the canned message. The canned messages length must be less than 200 character.""" - if len(message) > 800: - our_exit("Warning: The canned message must be less than 800 characters.") + if len(message) > 200: + our_exit("Warning: The canned message must be less than 200 characters.") # split into chunks chunks = [] @@ -505,13 +429,7 @@ class Node: # TODO: should be a way to improve this if i == 0: - p.set_canned_message_module_part1 = chunk - elif i == 1: - p.set_canned_message_module_part2 = chunk - elif i == 2: - p.set_canned_message_module_part3 = chunk - elif i == 3: - p.set_canned_message_module_part4 = chunk + p.set_canned_message_module_messages = chunk logging.debug(f"Setting canned message '{chunk}' part {i+1}") self._sendAdmin(p) diff --git a/proto b/proto index c473ed7..d8a5c17 160000 --- a/proto +++ b/proto @@ -1 +1 @@ -Subproject commit c473ed7a6aa83c4be80382aa9abf8f8258be40a3 +Subproject commit d8a5c17297078991bf2f20444c04969f50a33034