mirror of
https://github.com/meshtastic/python.git
synced 2025-12-26 17:37:51 -05:00
2241 lines
95 KiB
HTML
2241 lines
95 KiB
HTML
<!doctype html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1" />
|
|
<meta name="generator" content="pdoc 0.10.0" />
|
|
<title>meshtastic.deviceonly_pb2 API documentation</title>
|
|
<meta name="description" content="" />
|
|
<link rel="preload stylesheet" as="style" href="https://cdnjs.cloudflare.com/ajax/libs/10up-sanitize.css/11.0.1/sanitize.min.css" integrity="sha256-PK9q560IAAa6WVRRh76LtCaI8pjTJ2z11v0miyNNjrs=" crossorigin>
|
|
<link rel="preload stylesheet" as="style" href="https://cdnjs.cloudflare.com/ajax/libs/10up-sanitize.css/11.0.1/typography.min.css" integrity="sha256-7l/o7C8jubJiy74VsKTidCy1yBkRtiUGbVkYBylBqUg=" crossorigin>
|
|
<link rel="stylesheet preload" as="style" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/10.1.1/styles/github.min.css" crossorigin>
|
|
<style>:root{--highlight-color:#fe9}.flex{display:flex !important}body{line-height:1.5em}#content{padding:20px}#sidebar{padding:30px;overflow:hidden}#sidebar > *:last-child{margin-bottom:2cm}.http-server-breadcrumbs{font-size:130%;margin:0 0 15px 0}#footer{font-size:.75em;padding:5px 30px;border-top:1px solid #ddd;text-align:right}#footer p{margin:0 0 0 1em;display:inline-block}#footer p:last-child{margin-right:30px}h1,h2,h3,h4,h5{font-weight:300}h1{font-size:2.5em;line-height:1.1em}h2{font-size:1.75em;margin:1em 0 .50em 0}h3{font-size:1.4em;margin:25px 0 10px 0}h4{margin:0;font-size:105%}h1:target,h2:target,h3:target,h4:target,h5:target,h6:target{background:var(--highlight-color);padding:.2em 0}a{color:#058;text-decoration:none;transition:color .3s ease-in-out}a:hover{color:#e82}.title code{font-weight:bold}h2[id^="header-"]{margin-top:2em}.ident{color:#900}pre code{background:#f8f8f8;font-size:.8em;line-height:1.4em}code{background:#f2f2f1;padding:1px 4px;overflow-wrap:break-word}h1 code{background:transparent}pre{background:#f8f8f8;border:0;border-top:1px solid #ccc;border-bottom:1px solid #ccc;margin:1em 0;padding:1ex}#http-server-module-list{display:flex;flex-flow:column}#http-server-module-list div{display:flex}#http-server-module-list dt{min-width:10%}#http-server-module-list p{margin-top:0}.toc ul,#index{list-style-type:none;margin:0;padding:0}#index code{background:transparent}#index h3{border-bottom:1px solid #ddd}#index ul{padding:0}#index h4{margin-top:.6em;font-weight:bold}@media (min-width:200ex){#index .two-column{column-count:2}}@media (min-width:300ex){#index .two-column{column-count:3}}dl{margin-bottom:2em}dl dl:last-child{margin-bottom:4em}dd{margin:0 0 1em 3em}#header-classes + dl > dd{margin-bottom:3em}dd dd{margin-left:2em}dd p{margin:10px 0}.name{background:#eee;font-weight:bold;font-size:.85em;padding:5px 10px;display:inline-block;min-width:40%}.name:hover{background:#e0e0e0}dt:target .name{background:var(--highlight-color)}.name > span:first-child{white-space:nowrap}.name.class > span:nth-child(2){margin-left:.4em}.inherited{color:#999;border-left:5px solid #eee;padding-left:1em}.inheritance em{font-style:normal;font-weight:bold}.desc h2{font-weight:400;font-size:1.25em}.desc h3{font-size:1em}.desc dt code{background:inherit}.source summary,.git-link-div{color:#666;text-align:right;font-weight:400;font-size:.8em;text-transform:uppercase}.source summary > *{white-space:nowrap;cursor:pointer}.git-link{color:inherit;margin-left:1em}.source pre{max-height:500px;overflow:auto;margin:0}.source pre code{font-size:12px;overflow:visible}.hlist{list-style:none}.hlist li{display:inline}.hlist li:after{content:',\2002'}.hlist li:last-child:after{content:none}.hlist .hlist{display:inline;padding-left:1em}img{max-width:100%}td{padding:0 .5em}.admonition{padding:.1em .5em;margin-bottom:1em}.admonition-title{font-weight:bold}.admonition.note,.admonition.info,.admonition.important{background:#aef}.admonition.todo,.admonition.versionadded,.admonition.tip,.admonition.hint{background:#dfd}.admonition.warning,.admonition.versionchanged,.admonition.deprecated{background:#fd4}.admonition.error,.admonition.danger,.admonition.caution{background:lightpink}</style>
|
|
<style media="screen and (min-width: 700px)">@media screen and (min-width:700px){#sidebar{width:30%;height:100vh;overflow:auto;position:sticky;top:0}#content{width:70%;max-width:100ch;padding:3em 4em;border-left:1px solid #ddd}pre code{font-size:1em}.item .name{font-size:1em}main{display:flex;flex-direction:row-reverse;justify-content:flex-end}.toc ul ul,#index ul{padding-left:1.5em}.toc > ul > li{margin-top:.5em}}</style>
|
|
<style media="print">@media print{#sidebar h1{page-break-before:always}.source{display:none}}@media print{*{background:transparent !important;color:#000 !important;box-shadow:none !important;text-shadow:none !important}a[href]:after{content:" (" attr(href) ")";font-size:90%}a[href][title]:after{content:none}abbr[title]:after{content:" (" attr(title) ")"}.ir a:after,a[href^="javascript:"]:after,a[href^="#"]:after{content:""}pre,blockquote{border:1px solid #999;page-break-inside:avoid}thead{display:table-header-group}tr,img{page-break-inside:avoid}img{max-width:100% !important}@page{margin:0.5cm}p,h2,h3{orphans:3;widows:3}h1,h2,h3,h4,h5,h6{page-break-after:avoid}}</style>
|
|
<script defer src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/10.1.1/highlight.min.js" integrity="sha256-Uv3H6lx7dJmRfRvH8TH6kJD1TSK1aFcwgx+mdg3epi8=" crossorigin></script>
|
|
<script>window.addEventListener('DOMContentLoaded', () => hljs.initHighlighting())</script>
|
|
</head>
|
|
<body>
|
|
<main>
|
|
<article id="content">
|
|
<header>
|
|
<h1 class="title">Module <code>meshtastic.deviceonly_pb2</code></h1>
|
|
</header>
|
|
<section id="section-intro">
|
|
<details class="source">
|
|
<summary>
|
|
<span>Expand source code</span>
|
|
</summary>
|
|
<pre><code class="python"># -*- coding: utf-8 -*-
|
|
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
|
# source: deviceonly.proto
|
|
|
|
from google.protobuf import descriptor as _descriptor
|
|
from google.protobuf import message as _message
|
|
from google.protobuf import reflection as _reflection
|
|
from google.protobuf import symbol_database as _symbol_database
|
|
# @@protoc_insertion_point(imports)
|
|
|
|
_sym_db = _symbol_database.Default()
|
|
|
|
|
|
from . import mesh_pb2 as mesh__pb2
|
|
from . import channel_pb2 as channel__pb2
|
|
from . import radioconfig_pb2 as radioconfig__pb2
|
|
|
|
|
|
DESCRIPTOR = _descriptor.FileDescriptor(
|
|
name='deviceonly.proto',
|
|
package='',
|
|
syntax='proto3',
|
|
serialized_options=b'\n\023com.geeksville.meshB\nDeviceOnlyH\003Z!github.com/meshtastic/gomeshproto',
|
|
serialized_pb=b'\n\x10\x64\x65viceonly.proto\x1a\nmesh.proto\x1a\rchannel.proto\x1a\x11radioconfig.proto\"\x80\x01\n\x11LegacyRadioConfig\x12\x39\n\x0bpreferences\x18\x01 \x01(\x0b\x32$.LegacyRadioConfig.LegacyPreferences\x1a\x30\n\x11LegacyPreferences\x12\x1b\n\x06region\x18\x0f \x01(\x0e\x32\x0b.RegionCode\"\x8f\x02\n\x0b\x44\x65viceState\x12\'\n\x0blegacyRadio\x18\x01 \x01(\x0b\x32\x12.LegacyRadioConfig\x12\x1c\n\x07my_node\x18\x02 \x01(\x0b\x32\x0b.MyNodeInfo\x12\x14\n\x05owner\x18\x03 \x01(\x0b\x32\x05.User\x12\x1a\n\x07node_db\x18\x04 \x03(\x0b\x32\t.NodeInfo\x12\"\n\rreceive_queue\x18\x05 \x03(\x0b\x32\x0b.MeshPacket\x12\x0f\n\x07version\x18\x08 \x01(\r\x12$\n\x0frx_text_message\x18\x07 \x01(\x0b\x32\x0b.MeshPacket\x12\x0f\n\x07no_save\x18\t \x01(\x08\x12\x15\n\rdid_gps_reset\x18\x0b \x01(\x08J\x04\x08\x0c\x10\r\")\n\x0b\x43hannelFile\x12\x1a\n\x08\x63hannels\x18\x01 \x03(\x0b\x32\x08.ChannelBF\n\x13\x63om.geeksville.meshB\nDeviceOnlyH\x03Z!github.com/meshtastic/gomeshprotob\x06proto3'
|
|
,
|
|
dependencies=[mesh__pb2.DESCRIPTOR,channel__pb2.DESCRIPTOR,radioconfig__pb2.DESCRIPTOR,])
|
|
|
|
|
|
|
|
|
|
_LEGACYRADIOCONFIG_LEGACYPREFERENCES = _descriptor.Descriptor(
|
|
name='LegacyPreferences',
|
|
full_name='LegacyRadioConfig.LegacyPreferences',
|
|
filename=None,
|
|
file=DESCRIPTOR,
|
|
containing_type=None,
|
|
fields=[
|
|
_descriptor.FieldDescriptor(
|
|
name='region', full_name='LegacyRadioConfig.LegacyPreferences.region', index=0,
|
|
number=15, type=14, cpp_type=8, label=1,
|
|
has_default_value=False, default_value=0,
|
|
message_type=None, enum_type=None, containing_type=None,
|
|
is_extension=False, extension_scope=None,
|
|
serialized_options=None, file=DESCRIPTOR),
|
|
],
|
|
extensions=[
|
|
],
|
|
nested_types=[],
|
|
enum_types=[
|
|
],
|
|
serialized_options=None,
|
|
is_extendable=False,
|
|
syntax='proto3',
|
|
extension_ranges=[],
|
|
oneofs=[
|
|
],
|
|
serialized_start=147,
|
|
serialized_end=195,
|
|
)
|
|
|
|
_LEGACYRADIOCONFIG = _descriptor.Descriptor(
|
|
name='LegacyRadioConfig',
|
|
full_name='LegacyRadioConfig',
|
|
filename=None,
|
|
file=DESCRIPTOR,
|
|
containing_type=None,
|
|
fields=[
|
|
_descriptor.FieldDescriptor(
|
|
name='preferences', full_name='LegacyRadioConfig.preferences', index=0,
|
|
number=1, type=11, cpp_type=10, label=1,
|
|
has_default_value=False, default_value=None,
|
|
message_type=None, enum_type=None, containing_type=None,
|
|
is_extension=False, extension_scope=None,
|
|
serialized_options=None, file=DESCRIPTOR),
|
|
],
|
|
extensions=[
|
|
],
|
|
nested_types=[_LEGACYRADIOCONFIG_LEGACYPREFERENCES, ],
|
|
enum_types=[
|
|
],
|
|
serialized_options=None,
|
|
is_extendable=False,
|
|
syntax='proto3',
|
|
extension_ranges=[],
|
|
oneofs=[
|
|
],
|
|
serialized_start=67,
|
|
serialized_end=195,
|
|
)
|
|
|
|
|
|
_DEVICESTATE = _descriptor.Descriptor(
|
|
name='DeviceState',
|
|
full_name='DeviceState',
|
|
filename=None,
|
|
file=DESCRIPTOR,
|
|
containing_type=None,
|
|
fields=[
|
|
_descriptor.FieldDescriptor(
|
|
name='legacyRadio', full_name='DeviceState.legacyRadio', index=0,
|
|
number=1, type=11, cpp_type=10, label=1,
|
|
has_default_value=False, default_value=None,
|
|
message_type=None, enum_type=None, containing_type=None,
|
|
is_extension=False, extension_scope=None,
|
|
serialized_options=None, file=DESCRIPTOR),
|
|
_descriptor.FieldDescriptor(
|
|
name='my_node', full_name='DeviceState.my_node', index=1,
|
|
number=2, type=11, cpp_type=10, label=1,
|
|
has_default_value=False, default_value=None,
|
|
message_type=None, enum_type=None, containing_type=None,
|
|
is_extension=False, extension_scope=None,
|
|
serialized_options=None, file=DESCRIPTOR),
|
|
_descriptor.FieldDescriptor(
|
|
name='owner', full_name='DeviceState.owner', index=2,
|
|
number=3, type=11, cpp_type=10, label=1,
|
|
has_default_value=False, default_value=None,
|
|
message_type=None, enum_type=None, containing_type=None,
|
|
is_extension=False, extension_scope=None,
|
|
serialized_options=None, file=DESCRIPTOR),
|
|
_descriptor.FieldDescriptor(
|
|
name='node_db', full_name='DeviceState.node_db', index=3,
|
|
number=4, type=11, cpp_type=10, label=3,
|
|
has_default_value=False, default_value=[],
|
|
message_type=None, enum_type=None, containing_type=None,
|
|
is_extension=False, extension_scope=None,
|
|
serialized_options=None, file=DESCRIPTOR),
|
|
_descriptor.FieldDescriptor(
|
|
name='receive_queue', full_name='DeviceState.receive_queue', index=4,
|
|
number=5, type=11, cpp_type=10, label=3,
|
|
has_default_value=False, default_value=[],
|
|
message_type=None, enum_type=None, containing_type=None,
|
|
is_extension=False, extension_scope=None,
|
|
serialized_options=None, file=DESCRIPTOR),
|
|
_descriptor.FieldDescriptor(
|
|
name='version', full_name='DeviceState.version', index=5,
|
|
number=8, type=13, cpp_type=3, label=1,
|
|
has_default_value=False, default_value=0,
|
|
message_type=None, enum_type=None, containing_type=None,
|
|
is_extension=False, extension_scope=None,
|
|
serialized_options=None, file=DESCRIPTOR),
|
|
_descriptor.FieldDescriptor(
|
|
name='rx_text_message', full_name='DeviceState.rx_text_message', index=6,
|
|
number=7, type=11, cpp_type=10, label=1,
|
|
has_default_value=False, default_value=None,
|
|
message_type=None, enum_type=None, containing_type=None,
|
|
is_extension=False, extension_scope=None,
|
|
serialized_options=None, file=DESCRIPTOR),
|
|
_descriptor.FieldDescriptor(
|
|
name='no_save', full_name='DeviceState.no_save', index=7,
|
|
number=9, type=8, cpp_type=7, label=1,
|
|
has_default_value=False, default_value=False,
|
|
message_type=None, enum_type=None, containing_type=None,
|
|
is_extension=False, extension_scope=None,
|
|
serialized_options=None, file=DESCRIPTOR),
|
|
_descriptor.FieldDescriptor(
|
|
name='did_gps_reset', full_name='DeviceState.did_gps_reset', index=8,
|
|
number=11, type=8, cpp_type=7, label=1,
|
|
has_default_value=False, default_value=False,
|
|
message_type=None, enum_type=None, containing_type=None,
|
|
is_extension=False, extension_scope=None,
|
|
serialized_options=None, file=DESCRIPTOR),
|
|
],
|
|
extensions=[
|
|
],
|
|
nested_types=[],
|
|
enum_types=[
|
|
],
|
|
serialized_options=None,
|
|
is_extendable=False,
|
|
syntax='proto3',
|
|
extension_ranges=[],
|
|
oneofs=[
|
|
],
|
|
serialized_start=198,
|
|
serialized_end=469,
|
|
)
|
|
|
|
|
|
_CHANNELFILE = _descriptor.Descriptor(
|
|
name='ChannelFile',
|
|
full_name='ChannelFile',
|
|
filename=None,
|
|
file=DESCRIPTOR,
|
|
containing_type=None,
|
|
fields=[
|
|
_descriptor.FieldDescriptor(
|
|
name='channels', full_name='ChannelFile.channels', index=0,
|
|
number=1, type=11, cpp_type=10, label=3,
|
|
has_default_value=False, default_value=[],
|
|
message_type=None, enum_type=None, containing_type=None,
|
|
is_extension=False, extension_scope=None,
|
|
serialized_options=None, file=DESCRIPTOR),
|
|
],
|
|
extensions=[
|
|
],
|
|
nested_types=[],
|
|
enum_types=[
|
|
],
|
|
serialized_options=None,
|
|
is_extendable=False,
|
|
syntax='proto3',
|
|
extension_ranges=[],
|
|
oneofs=[
|
|
],
|
|
serialized_start=471,
|
|
serialized_end=512,
|
|
)
|
|
|
|
_LEGACYRADIOCONFIG_LEGACYPREFERENCES.fields_by_name['region'].enum_type = radioconfig__pb2._REGIONCODE
|
|
_LEGACYRADIOCONFIG_LEGACYPREFERENCES.containing_type = _LEGACYRADIOCONFIG
|
|
_LEGACYRADIOCONFIG.fields_by_name['preferences'].message_type = _LEGACYRADIOCONFIG_LEGACYPREFERENCES
|
|
_DEVICESTATE.fields_by_name['legacyRadio'].message_type = _LEGACYRADIOCONFIG
|
|
_DEVICESTATE.fields_by_name['my_node'].message_type = mesh__pb2._MYNODEINFO
|
|
_DEVICESTATE.fields_by_name['owner'].message_type = mesh__pb2._USER
|
|
_DEVICESTATE.fields_by_name['node_db'].message_type = mesh__pb2._NODEINFO
|
|
_DEVICESTATE.fields_by_name['receive_queue'].message_type = mesh__pb2._MESHPACKET
|
|
_DEVICESTATE.fields_by_name['rx_text_message'].message_type = mesh__pb2._MESHPACKET
|
|
_CHANNELFILE.fields_by_name['channels'].message_type = channel__pb2._CHANNEL
|
|
DESCRIPTOR.message_types_by_name['LegacyRadioConfig'] = _LEGACYRADIOCONFIG
|
|
DESCRIPTOR.message_types_by_name['DeviceState'] = _DEVICESTATE
|
|
DESCRIPTOR.message_types_by_name['ChannelFile'] = _CHANNELFILE
|
|
_sym_db.RegisterFileDescriptor(DESCRIPTOR)
|
|
|
|
LegacyRadioConfig = _reflection.GeneratedProtocolMessageType('LegacyRadioConfig', (_message.Message,), {
|
|
|
|
'LegacyPreferences' : _reflection.GeneratedProtocolMessageType('LegacyPreferences', (_message.Message,), {
|
|
'DESCRIPTOR' : _LEGACYRADIOCONFIG_LEGACYPREFERENCES,
|
|
'__module__' : 'deviceonly_pb2'
|
|
# @@protoc_insertion_point(class_scope:LegacyRadioConfig.LegacyPreferences)
|
|
})
|
|
,
|
|
'DESCRIPTOR' : _LEGACYRADIOCONFIG,
|
|
'__module__' : 'deviceonly_pb2'
|
|
# @@protoc_insertion_point(class_scope:LegacyRadioConfig)
|
|
})
|
|
_sym_db.RegisterMessage(LegacyRadioConfig)
|
|
_sym_db.RegisterMessage(LegacyRadioConfig.LegacyPreferences)
|
|
|
|
DeviceState = _reflection.GeneratedProtocolMessageType('DeviceState', (_message.Message,), {
|
|
'DESCRIPTOR' : _DEVICESTATE,
|
|
'__module__' : 'deviceonly_pb2'
|
|
# @@protoc_insertion_point(class_scope:DeviceState)
|
|
})
|
|
_sym_db.RegisterMessage(DeviceState)
|
|
|
|
ChannelFile = _reflection.GeneratedProtocolMessageType('ChannelFile', (_message.Message,), {
|
|
'DESCRIPTOR' : _CHANNELFILE,
|
|
'__module__' : 'deviceonly_pb2'
|
|
# @@protoc_insertion_point(class_scope:ChannelFile)
|
|
})
|
|
_sym_db.RegisterMessage(ChannelFile)
|
|
|
|
|
|
DESCRIPTOR._options = None
|
|
# @@protoc_insertion_point(module_scope)</code></pre>
|
|
</details>
|
|
</section>
|
|
<section>
|
|
</section>
|
|
<section>
|
|
</section>
|
|
<section>
|
|
</section>
|
|
<section>
|
|
<h2 class="section-title" id="header-classes">Classes</h2>
|
|
<dl>
|
|
<dt id="meshtastic.deviceonly_pb2.ChannelFile"><code class="flex name class">
|
|
<span>class <span class="ident">ChannelFile</span></span>
|
|
<span>(</span><span>**kwargs)</span>
|
|
</code></dt>
|
|
<dd>
|
|
<div class="desc"><p>Abstract base class for protocol messages.</p>
|
|
<p>Protocol message classes are almost always generated by the protocol
|
|
compiler.
|
|
These generated types subclass Message and implement the methods
|
|
shown below.</p></div>
|
|
<h3>Ancestors</h3>
|
|
<ul class="hlist">
|
|
<li>google.protobuf.message.Message</li>
|
|
</ul>
|
|
<h3>Class variables</h3>
|
|
<dl>
|
|
<dt id="meshtastic.deviceonly_pb2.ChannelFile.CHANNELS_FIELD_NUMBER"><code class="name">var <span class="ident">CHANNELS_FIELD_NUMBER</span></code></dt>
|
|
<dd>
|
|
<div class="desc"></div>
|
|
</dd>
|
|
<dt id="meshtastic.deviceonly_pb2.ChannelFile.DESCRIPTOR"><code class="name">var <span class="ident">DESCRIPTOR</span></code></dt>
|
|
<dd>
|
|
<div class="desc"></div>
|
|
</dd>
|
|
</dl>
|
|
<h3>Static methods</h3>
|
|
<dl>
|
|
<dt id="meshtastic.deviceonly_pb2.ChannelFile.FromString"><code class="name flex">
|
|
<span>def <span class="ident">FromString</span></span>(<span>s)</span>
|
|
</code></dt>
|
|
<dd>
|
|
<div class="desc"></div>
|
|
<details class="source">
|
|
<summary>
|
|
<span>Expand source code</span>
|
|
</summary>
|
|
<pre><code class="python">def FromString(s):
|
|
message = cls()
|
|
message.MergeFromString(s)
|
|
return message</code></pre>
|
|
</details>
|
|
</dd>
|
|
<dt id="meshtastic.deviceonly_pb2.ChannelFile.RegisterExtension"><code class="name flex">
|
|
<span>def <span class="ident">RegisterExtension</span></span>(<span>extension_handle)</span>
|
|
</code></dt>
|
|
<dd>
|
|
<div class="desc"></div>
|
|
<details class="source">
|
|
<summary>
|
|
<span>Expand source code</span>
|
|
</summary>
|
|
<pre><code class="python">def RegisterExtension(extension_handle):
|
|
extension_handle.containing_type = cls.DESCRIPTOR
|
|
# TODO(amauryfa): Use cls.MESSAGE_FACTORY.pool when available.
|
|
# pylint: disable=protected-access
|
|
cls.DESCRIPTOR.file.pool._AddExtensionDescriptor(extension_handle)
|
|
_AttachFieldHelpers(cls, extension_handle)</code></pre>
|
|
</details>
|
|
</dd>
|
|
</dl>
|
|
<h3>Instance variables</h3>
|
|
<dl>
|
|
<dt id="meshtastic.deviceonly_pb2.ChannelFile.channels"><code class="name">var <span class="ident">channels</span></code></dt>
|
|
<dd>
|
|
<div class="desc"><p>Getter for channels.</p></div>
|
|
<details class="source">
|
|
<summary>
|
|
<span>Expand source code</span>
|
|
</summary>
|
|
<pre><code class="python">def getter(self):
|
|
field_value = self._fields.get(field)
|
|
if field_value is None:
|
|
# Construct a new object to represent this field.
|
|
field_value = field._default_constructor(self)
|
|
|
|
# Atomically check if another thread has preempted us and, if not, swap
|
|
# in the new object we just created. If someone has preempted us, we
|
|
# take that object and discard ours.
|
|
# WARNING: We are relying on setdefault() being atomic. This is true
|
|
# in CPython but we haven't investigated others. This warning appears
|
|
# in several other locations in this file.
|
|
field_value = self._fields.setdefault(field, field_value)
|
|
return field_value</code></pre>
|
|
</details>
|
|
</dd>
|
|
</dl>
|
|
<h3>Methods</h3>
|
|
<dl>
|
|
<dt id="meshtastic.deviceonly_pb2.ChannelFile.ByteSize"><code class="name flex">
|
|
<span>def <span class="ident">ByteSize</span></span>(<span>self)</span>
|
|
</code></dt>
|
|
<dd>
|
|
<div class="desc"></div>
|
|
<details class="source">
|
|
<summary>
|
|
<span>Expand source code</span>
|
|
</summary>
|
|
<pre><code class="python">def ByteSize(self):
|
|
if not self._cached_byte_size_dirty:
|
|
return self._cached_byte_size
|
|
|
|
size = 0
|
|
descriptor = self.DESCRIPTOR
|
|
if descriptor.GetOptions().map_entry:
|
|
# Fields of map entry should always be serialized.
|
|
size = descriptor.fields_by_name['key']._sizer(self.key)
|
|
size += descriptor.fields_by_name['value']._sizer(self.value)
|
|
else:
|
|
for field_descriptor, field_value in self.ListFields():
|
|
size += field_descriptor._sizer(field_value)
|
|
for tag_bytes, value_bytes in self._unknown_fields:
|
|
size += len(tag_bytes) + len(value_bytes)
|
|
|
|
self._cached_byte_size = size
|
|
self._cached_byte_size_dirty = False
|
|
self._listener_for_children.dirty = False
|
|
return size</code></pre>
|
|
</details>
|
|
</dd>
|
|
<dt id="meshtastic.deviceonly_pb2.ChannelFile.Clear"><code class="name flex">
|
|
<span>def <span class="ident">Clear</span></span>(<span>self)</span>
|
|
</code></dt>
|
|
<dd>
|
|
<div class="desc"></div>
|
|
<details class="source">
|
|
<summary>
|
|
<span>Expand source code</span>
|
|
</summary>
|
|
<pre><code class="python">def _Clear(self):
|
|
# Clear fields.
|
|
self._fields = {}
|
|
self._unknown_fields = ()
|
|
# pylint: disable=protected-access
|
|
if self._unknown_field_set is not None:
|
|
self._unknown_field_set._clear()
|
|
self._unknown_field_set = None
|
|
|
|
self._oneofs = {}
|
|
self._Modified()</code></pre>
|
|
</details>
|
|
</dd>
|
|
<dt id="meshtastic.deviceonly_pb2.ChannelFile.ClearField"><code class="name flex">
|
|
<span>def <span class="ident">ClearField</span></span>(<span>self, field_name)</span>
|
|
</code></dt>
|
|
<dd>
|
|
<div class="desc"></div>
|
|
<details class="source">
|
|
<summary>
|
|
<span>Expand source code</span>
|
|
</summary>
|
|
<pre><code class="python">def ClearField(self, field_name):
|
|
try:
|
|
field = message_descriptor.fields_by_name[field_name]
|
|
except KeyError:
|
|
try:
|
|
field = message_descriptor.oneofs_by_name[field_name]
|
|
if field in self._oneofs:
|
|
field = self._oneofs[field]
|
|
else:
|
|
return
|
|
except KeyError:
|
|
raise ValueError('Protocol message %s has no "%s" field.' %
|
|
(message_descriptor.name, field_name))
|
|
|
|
if field in self._fields:
|
|
# To match the C++ implementation, we need to invalidate iterators
|
|
# for map fields when ClearField() happens.
|
|
if hasattr(self._fields[field], 'InvalidateIterators'):
|
|
self._fields[field].InvalidateIterators()
|
|
|
|
# Note: If the field is a sub-message, its listener will still point
|
|
# at us. That's fine, because the worst than can happen is that it
|
|
# will call _Modified() and invalidate our byte size. Big deal.
|
|
del self._fields[field]
|
|
|
|
if self._oneofs.get(field.containing_oneof, None) is field:
|
|
del self._oneofs[field.containing_oneof]
|
|
|
|
# Always call _Modified() -- even if nothing was changed, this is
|
|
# a mutating method, and thus calling it should cause the field to become
|
|
# present in the parent message.
|
|
self._Modified()</code></pre>
|
|
</details>
|
|
</dd>
|
|
<dt id="meshtastic.deviceonly_pb2.ChannelFile.DiscardUnknownFields"><code class="name flex">
|
|
<span>def <span class="ident">DiscardUnknownFields</span></span>(<span>self)</span>
|
|
</code></dt>
|
|
<dd>
|
|
<div class="desc"></div>
|
|
<details class="source">
|
|
<summary>
|
|
<span>Expand source code</span>
|
|
</summary>
|
|
<pre><code class="python">def _DiscardUnknownFields(self):
|
|
self._unknown_fields = []
|
|
self._unknown_field_set = None # pylint: disable=protected-access
|
|
for field, value in self.ListFields():
|
|
if field.cpp_type == _FieldDescriptor.CPPTYPE_MESSAGE:
|
|
if _IsMapField(field):
|
|
if _IsMessageMapField(field):
|
|
for key in value:
|
|
value[key].DiscardUnknownFields()
|
|
elif field.label == _FieldDescriptor.LABEL_REPEATED:
|
|
for sub_message in value:
|
|
sub_message.DiscardUnknownFields()
|
|
else:
|
|
value.DiscardUnknownFields()</code></pre>
|
|
</details>
|
|
</dd>
|
|
<dt id="meshtastic.deviceonly_pb2.ChannelFile.FindInitializationErrors"><code class="name flex">
|
|
<span>def <span class="ident">FindInitializationErrors</span></span>(<span>self)</span>
|
|
</code></dt>
|
|
<dd>
|
|
<div class="desc"><p>Finds required fields which are not initialized.</p>
|
|
<h2 id="returns">Returns</h2>
|
|
<p>A list of strings.
|
|
Each string is a path to an uninitialized field from
|
|
the top-level message, e.g. "foo.bar[5].baz".</p></div>
|
|
<details class="source">
|
|
<summary>
|
|
<span>Expand source code</span>
|
|
</summary>
|
|
<pre><code class="python">def FindInitializationErrors(self):
|
|
"""Finds required fields which are not initialized.
|
|
|
|
Returns:
|
|
A list of strings. Each string is a path to an uninitialized field from
|
|
the top-level message, e.g. "foo.bar[5].baz".
|
|
"""
|
|
|
|
errors = [] # simplify things
|
|
|
|
for field in required_fields:
|
|
if not self.HasField(field.name):
|
|
errors.append(field.name)
|
|
|
|
for field, value in self.ListFields():
|
|
if field.cpp_type == _FieldDescriptor.CPPTYPE_MESSAGE:
|
|
if field.is_extension:
|
|
name = '(%s)' % field.full_name
|
|
else:
|
|
name = field.name
|
|
|
|
if _IsMapField(field):
|
|
if _IsMessageMapField(field):
|
|
for key in value:
|
|
element = value[key]
|
|
prefix = '%s[%s].' % (name, key)
|
|
sub_errors = element.FindInitializationErrors()
|
|
errors += [prefix + error for error in sub_errors]
|
|
else:
|
|
# ScalarMaps can't have any initialization errors.
|
|
pass
|
|
elif field.label == _FieldDescriptor.LABEL_REPEATED:
|
|
for i in range(len(value)):
|
|
element = value[i]
|
|
prefix = '%s[%d].' % (name, i)
|
|
sub_errors = element.FindInitializationErrors()
|
|
errors += [prefix + error for error in sub_errors]
|
|
else:
|
|
prefix = name + '.'
|
|
sub_errors = value.FindInitializationErrors()
|
|
errors += [prefix + error for error in sub_errors]
|
|
|
|
return errors</code></pre>
|
|
</details>
|
|
</dd>
|
|
<dt id="meshtastic.deviceonly_pb2.ChannelFile.HasField"><code class="name flex">
|
|
<span>def <span class="ident">HasField</span></span>(<span>self, field_name)</span>
|
|
</code></dt>
|
|
<dd>
|
|
<div class="desc"></div>
|
|
<details class="source">
|
|
<summary>
|
|
<span>Expand source code</span>
|
|
</summary>
|
|
<pre><code class="python">def HasField(self, field_name):
|
|
try:
|
|
field = hassable_fields[field_name]
|
|
except KeyError:
|
|
raise ValueError(error_msg % (message_descriptor.full_name, field_name))
|
|
|
|
if isinstance(field, descriptor_mod.OneofDescriptor):
|
|
try:
|
|
return HasField(self, self._oneofs[field].name)
|
|
except KeyError:
|
|
return False
|
|
else:
|
|
if field.cpp_type == _FieldDescriptor.CPPTYPE_MESSAGE:
|
|
value = self._fields.get(field)
|
|
return value is not None and value._is_present_in_parent
|
|
else:
|
|
return field in self._fields</code></pre>
|
|
</details>
|
|
</dd>
|
|
<dt id="meshtastic.deviceonly_pb2.ChannelFile.IsInitialized"><code class="name flex">
|
|
<span>def <span class="ident">IsInitialized</span></span>(<span>self, errors=None)</span>
|
|
</code></dt>
|
|
<dd>
|
|
<div class="desc"><p>Checks if all required fields of a message are set.</p>
|
|
<h2 id="args">Args</h2>
|
|
<dl>
|
|
<dt><strong><code>errors</code></strong></dt>
|
|
<dd>A list which, if provided, will be populated with the field
|
|
paths of all missing required fields.</dd>
|
|
</dl>
|
|
<h2 id="returns">Returns</h2>
|
|
<p>True iff the specified message has all required fields set.</p></div>
|
|
<details class="source">
|
|
<summary>
|
|
<span>Expand source code</span>
|
|
</summary>
|
|
<pre><code class="python">def IsInitialized(self, errors=None):
|
|
"""Checks if all required fields of a message are set.
|
|
|
|
Args:
|
|
errors: A list which, if provided, will be populated with the field
|
|
paths of all missing required fields.
|
|
|
|
Returns:
|
|
True iff the specified message has all required fields set.
|
|
"""
|
|
|
|
# Performance is critical so we avoid HasField() and ListFields().
|
|
|
|
for field in required_fields:
|
|
if (field not in self._fields or
|
|
(field.cpp_type == _FieldDescriptor.CPPTYPE_MESSAGE and
|
|
not self._fields[field]._is_present_in_parent)):
|
|
if errors is not None:
|
|
errors.extend(self.FindInitializationErrors())
|
|
return False
|
|
|
|
for field, value in list(self._fields.items()): # dict can change size!
|
|
if field.cpp_type == _FieldDescriptor.CPPTYPE_MESSAGE:
|
|
if field.label == _FieldDescriptor.LABEL_REPEATED:
|
|
if (field.message_type.has_options and
|
|
field.message_type.GetOptions().map_entry):
|
|
continue
|
|
for element in value:
|
|
if not element.IsInitialized():
|
|
if errors is not None:
|
|
errors.extend(self.FindInitializationErrors())
|
|
return False
|
|
elif value._is_present_in_parent and not value.IsInitialized():
|
|
if errors is not None:
|
|
errors.extend(self.FindInitializationErrors())
|
|
return False
|
|
|
|
return True</code></pre>
|
|
</details>
|
|
</dd>
|
|
<dt id="meshtastic.deviceonly_pb2.ChannelFile.ListFields"><code class="name flex">
|
|
<span>def <span class="ident">ListFields</span></span>(<span>self)</span>
|
|
</code></dt>
|
|
<dd>
|
|
<div class="desc"></div>
|
|
<details class="source">
|
|
<summary>
|
|
<span>Expand source code</span>
|
|
</summary>
|
|
<pre><code class="python">def ListFields(self):
|
|
all_fields = [item for item in self._fields.items() if _IsPresent(item)]
|
|
all_fields.sort(key = lambda item: item[0].number)
|
|
return all_fields</code></pre>
|
|
</details>
|
|
</dd>
|
|
<dt id="meshtastic.deviceonly_pb2.ChannelFile.MergeFrom"><code class="name flex">
|
|
<span>def <span class="ident">MergeFrom</span></span>(<span>self, msg)</span>
|
|
</code></dt>
|
|
<dd>
|
|
<div class="desc"></div>
|
|
<details class="source">
|
|
<summary>
|
|
<span>Expand source code</span>
|
|
</summary>
|
|
<pre><code class="python">def MergeFrom(self, msg):
|
|
if not isinstance(msg, cls):
|
|
raise TypeError(
|
|
'Parameter to MergeFrom() must be instance of same class: '
|
|
'expected %s got %s.' % (_FullyQualifiedClassName(cls),
|
|
_FullyQualifiedClassName(msg.__class__)))
|
|
|
|
assert msg is not self
|
|
self._Modified()
|
|
|
|
fields = self._fields
|
|
|
|
for field, value in msg._fields.items():
|
|
if field.label == LABEL_REPEATED:
|
|
field_value = fields.get(field)
|
|
if field_value is None:
|
|
# Construct a new object to represent this field.
|
|
field_value = field._default_constructor(self)
|
|
fields[field] = field_value
|
|
field_value.MergeFrom(value)
|
|
elif field.cpp_type == CPPTYPE_MESSAGE:
|
|
if value._is_present_in_parent:
|
|
field_value = fields.get(field)
|
|
if field_value is None:
|
|
# Construct a new object to represent this field.
|
|
field_value = field._default_constructor(self)
|
|
fields[field] = field_value
|
|
field_value.MergeFrom(value)
|
|
else:
|
|
self._fields[field] = value
|
|
if field.containing_oneof:
|
|
self._UpdateOneofState(field)
|
|
|
|
if msg._unknown_fields:
|
|
if not self._unknown_fields:
|
|
self._unknown_fields = []
|
|
self._unknown_fields.extend(msg._unknown_fields)
|
|
# pylint: disable=protected-access
|
|
if self._unknown_field_set is None:
|
|
self._unknown_field_set = containers.UnknownFieldSet()
|
|
self._unknown_field_set._extend(msg._unknown_field_set)</code></pre>
|
|
</details>
|
|
</dd>
|
|
<dt id="meshtastic.deviceonly_pb2.ChannelFile.MergeFromString"><code class="name flex">
|
|
<span>def <span class="ident">MergeFromString</span></span>(<span>self, serialized)</span>
|
|
</code></dt>
|
|
<dd>
|
|
<div class="desc"></div>
|
|
<details class="source">
|
|
<summary>
|
|
<span>Expand source code</span>
|
|
</summary>
|
|
<pre><code class="python">def MergeFromString(self, serialized):
|
|
serialized = memoryview(serialized)
|
|
length = len(serialized)
|
|
try:
|
|
if self._InternalParse(serialized, 0, length) != length:
|
|
# The only reason _InternalParse would return early is if it
|
|
# encountered an end-group tag.
|
|
raise message_mod.DecodeError('Unexpected end-group tag.')
|
|
except (IndexError, TypeError):
|
|
# Now ord(buf[p:p+1]) == ord('') gets TypeError.
|
|
raise message_mod.DecodeError('Truncated message.')
|
|
except struct.error as e:
|
|
raise message_mod.DecodeError(e)
|
|
return length # Return this for legacy reasons.</code></pre>
|
|
</details>
|
|
</dd>
|
|
<dt id="meshtastic.deviceonly_pb2.ChannelFile.SerializePartialToString"><code class="name flex">
|
|
<span>def <span class="ident">SerializePartialToString</span></span>(<span>self, **kwargs)</span>
|
|
</code></dt>
|
|
<dd>
|
|
<div class="desc"></div>
|
|
<details class="source">
|
|
<summary>
|
|
<span>Expand source code</span>
|
|
</summary>
|
|
<pre><code class="python">def SerializePartialToString(self, **kwargs):
|
|
out = BytesIO()
|
|
self._InternalSerialize(out.write, **kwargs)
|
|
return out.getvalue()</code></pre>
|
|
</details>
|
|
</dd>
|
|
<dt id="meshtastic.deviceonly_pb2.ChannelFile.SerializeToString"><code class="name flex">
|
|
<span>def <span class="ident">SerializeToString</span></span>(<span>self, **kwargs)</span>
|
|
</code></dt>
|
|
<dd>
|
|
<div class="desc"></div>
|
|
<details class="source">
|
|
<summary>
|
|
<span>Expand source code</span>
|
|
</summary>
|
|
<pre><code class="python">def SerializeToString(self, **kwargs):
|
|
# Check if the message has all of its required fields set.
|
|
if not self.IsInitialized():
|
|
raise message_mod.EncodeError(
|
|
'Message %s is missing required fields: %s' % (
|
|
self.DESCRIPTOR.full_name, ','.join(self.FindInitializationErrors())))
|
|
return self.SerializePartialToString(**kwargs)</code></pre>
|
|
</details>
|
|
</dd>
|
|
<dt id="meshtastic.deviceonly_pb2.ChannelFile.SetInParent"><code class="name flex">
|
|
<span>def <span class="ident">SetInParent</span></span>(<span>self)</span>
|
|
</code></dt>
|
|
<dd>
|
|
<div class="desc"><p>Sets the _cached_byte_size_dirty bit to true,
|
|
and propagates this to our listener iff this was a state change.</p></div>
|
|
<details class="source">
|
|
<summary>
|
|
<span>Expand source code</span>
|
|
</summary>
|
|
<pre><code class="python">def Modified(self):
|
|
"""Sets the _cached_byte_size_dirty bit to true,
|
|
and propagates this to our listener iff this was a state change.
|
|
"""
|
|
|
|
# Note: Some callers check _cached_byte_size_dirty before calling
|
|
# _Modified() as an extra optimization. So, if this method is ever
|
|
# changed such that it does stuff even when _cached_byte_size_dirty is
|
|
# already true, the callers need to be updated.
|
|
if not self._cached_byte_size_dirty:
|
|
self._cached_byte_size_dirty = True
|
|
self._listener_for_children.dirty = True
|
|
self._is_present_in_parent = True
|
|
self._listener.Modified()</code></pre>
|
|
</details>
|
|
</dd>
|
|
<dt id="meshtastic.deviceonly_pb2.ChannelFile.UnknownFields"><code class="name flex">
|
|
<span>def <span class="ident">UnknownFields</span></span>(<span>self)</span>
|
|
</code></dt>
|
|
<dd>
|
|
<div class="desc"></div>
|
|
<details class="source">
|
|
<summary>
|
|
<span>Expand source code</span>
|
|
</summary>
|
|
<pre><code class="python">def _UnknownFields(self):
|
|
if self._unknown_field_set is None: # pylint: disable=protected-access
|
|
# pylint: disable=protected-access
|
|
self._unknown_field_set = containers.UnknownFieldSet()
|
|
return self._unknown_field_set # pylint: disable=protected-access</code></pre>
|
|
</details>
|
|
</dd>
|
|
<dt id="meshtastic.deviceonly_pb2.ChannelFile.WhichOneof"><code class="name flex">
|
|
<span>def <span class="ident">WhichOneof</span></span>(<span>self, oneof_name)</span>
|
|
</code></dt>
|
|
<dd>
|
|
<div class="desc"><p>Returns the name of the currently set field inside a oneof, or None.</p></div>
|
|
<details class="source">
|
|
<summary>
|
|
<span>Expand source code</span>
|
|
</summary>
|
|
<pre><code class="python">def WhichOneof(self, oneof_name):
|
|
"""Returns the name of the currently set field inside a oneof, or None."""
|
|
try:
|
|
field = message_descriptor.oneofs_by_name[oneof_name]
|
|
except KeyError:
|
|
raise ValueError(
|
|
'Protocol message has no oneof "%s" field.' % oneof_name)
|
|
|
|
nested_field = self._oneofs.get(field, None)
|
|
if nested_field is not None and self.HasField(nested_field.name):
|
|
return nested_field.name
|
|
else:
|
|
return None</code></pre>
|
|
</details>
|
|
</dd>
|
|
</dl>
|
|
</dd>
|
|
<dt id="meshtastic.deviceonly_pb2.DeviceState"><code class="flex name class">
|
|
<span>class <span class="ident">DeviceState</span></span>
|
|
<span>(</span><span>**kwargs)</span>
|
|
</code></dt>
|
|
<dd>
|
|
<div class="desc"><p>Abstract base class for protocol messages.</p>
|
|
<p>Protocol message classes are almost always generated by the protocol
|
|
compiler.
|
|
These generated types subclass Message and implement the methods
|
|
shown below.</p></div>
|
|
<h3>Ancestors</h3>
|
|
<ul class="hlist">
|
|
<li>google.protobuf.message.Message</li>
|
|
</ul>
|
|
<h3>Class variables</h3>
|
|
<dl>
|
|
<dt id="meshtastic.deviceonly_pb2.DeviceState.DESCRIPTOR"><code class="name">var <span class="ident">DESCRIPTOR</span></code></dt>
|
|
<dd>
|
|
<div class="desc"></div>
|
|
</dd>
|
|
<dt id="meshtastic.deviceonly_pb2.DeviceState.DID_GPS_RESET_FIELD_NUMBER"><code class="name">var <span class="ident">DID_GPS_RESET_FIELD_NUMBER</span></code></dt>
|
|
<dd>
|
|
<div class="desc"></div>
|
|
</dd>
|
|
<dt id="meshtastic.deviceonly_pb2.DeviceState.LEGACYRADIO_FIELD_NUMBER"><code class="name">var <span class="ident">LEGACYRADIO_FIELD_NUMBER</span></code></dt>
|
|
<dd>
|
|
<div class="desc"></div>
|
|
</dd>
|
|
<dt id="meshtastic.deviceonly_pb2.DeviceState.MY_NODE_FIELD_NUMBER"><code class="name">var <span class="ident">MY_NODE_FIELD_NUMBER</span></code></dt>
|
|
<dd>
|
|
<div class="desc"></div>
|
|
</dd>
|
|
<dt id="meshtastic.deviceonly_pb2.DeviceState.NODE_DB_FIELD_NUMBER"><code class="name">var <span class="ident">NODE_DB_FIELD_NUMBER</span></code></dt>
|
|
<dd>
|
|
<div class="desc"></div>
|
|
</dd>
|
|
<dt id="meshtastic.deviceonly_pb2.DeviceState.NO_SAVE_FIELD_NUMBER"><code class="name">var <span class="ident">NO_SAVE_FIELD_NUMBER</span></code></dt>
|
|
<dd>
|
|
<div class="desc"></div>
|
|
</dd>
|
|
<dt id="meshtastic.deviceonly_pb2.DeviceState.OWNER_FIELD_NUMBER"><code class="name">var <span class="ident">OWNER_FIELD_NUMBER</span></code></dt>
|
|
<dd>
|
|
<div class="desc"></div>
|
|
</dd>
|
|
<dt id="meshtastic.deviceonly_pb2.DeviceState.RECEIVE_QUEUE_FIELD_NUMBER"><code class="name">var <span class="ident">RECEIVE_QUEUE_FIELD_NUMBER</span></code></dt>
|
|
<dd>
|
|
<div class="desc"></div>
|
|
</dd>
|
|
<dt id="meshtastic.deviceonly_pb2.DeviceState.RX_TEXT_MESSAGE_FIELD_NUMBER"><code class="name">var <span class="ident">RX_TEXT_MESSAGE_FIELD_NUMBER</span></code></dt>
|
|
<dd>
|
|
<div class="desc"></div>
|
|
</dd>
|
|
<dt id="meshtastic.deviceonly_pb2.DeviceState.VERSION_FIELD_NUMBER"><code class="name">var <span class="ident">VERSION_FIELD_NUMBER</span></code></dt>
|
|
<dd>
|
|
<div class="desc"></div>
|
|
</dd>
|
|
</dl>
|
|
<h3>Static methods</h3>
|
|
<dl>
|
|
<dt id="meshtastic.deviceonly_pb2.DeviceState.FromString"><code class="name flex">
|
|
<span>def <span class="ident">FromString</span></span>(<span>s)</span>
|
|
</code></dt>
|
|
<dd>
|
|
<div class="desc"></div>
|
|
<details class="source">
|
|
<summary>
|
|
<span>Expand source code</span>
|
|
</summary>
|
|
<pre><code class="python">def FromString(s):
|
|
message = cls()
|
|
message.MergeFromString(s)
|
|
return message</code></pre>
|
|
</details>
|
|
</dd>
|
|
<dt id="meshtastic.deviceonly_pb2.DeviceState.RegisterExtension"><code class="name flex">
|
|
<span>def <span class="ident">RegisterExtension</span></span>(<span>extension_handle)</span>
|
|
</code></dt>
|
|
<dd>
|
|
<div class="desc"></div>
|
|
<details class="source">
|
|
<summary>
|
|
<span>Expand source code</span>
|
|
</summary>
|
|
<pre><code class="python">def RegisterExtension(extension_handle):
|
|
extension_handle.containing_type = cls.DESCRIPTOR
|
|
# TODO(amauryfa): Use cls.MESSAGE_FACTORY.pool when available.
|
|
# pylint: disable=protected-access
|
|
cls.DESCRIPTOR.file.pool._AddExtensionDescriptor(extension_handle)
|
|
_AttachFieldHelpers(cls, extension_handle)</code></pre>
|
|
</details>
|
|
</dd>
|
|
</dl>
|
|
<h3>Instance variables</h3>
|
|
<dl>
|
|
<dt id="meshtastic.deviceonly_pb2.DeviceState.did_gps_reset"><code class="name">var <span class="ident">did_gps_reset</span></code></dt>
|
|
<dd>
|
|
<div class="desc"><p>Getter for did_gps_reset.</p></div>
|
|
<details class="source">
|
|
<summary>
|
|
<span>Expand source code</span>
|
|
</summary>
|
|
<pre><code class="python">def getter(self):
|
|
# TODO(protobuf-team): This may be broken since there may not be
|
|
# default_value. Combine with has_default_value somehow.
|
|
return self._fields.get(field, default_value)</code></pre>
|
|
</details>
|
|
</dd>
|
|
<dt id="meshtastic.deviceonly_pb2.DeviceState.legacyRadio"><code class="name">var <span class="ident">legacyRadio</span></code></dt>
|
|
<dd>
|
|
<div class="desc"><p>Getter for legacyRadio.</p></div>
|
|
<details class="source">
|
|
<summary>
|
|
<span>Expand source code</span>
|
|
</summary>
|
|
<pre><code class="python">def getter(self):
|
|
field_value = self._fields.get(field)
|
|
if field_value is None:
|
|
# Construct a new object to represent this field.
|
|
field_value = field._default_constructor(self)
|
|
|
|
# Atomically check if another thread has preempted us and, if not, swap
|
|
# in the new object we just created. If someone has preempted us, we
|
|
# take that object and discard ours.
|
|
# WARNING: We are relying on setdefault() being atomic. This is true
|
|
# in CPython but we haven't investigated others. This warning appears
|
|
# in several other locations in this file.
|
|
field_value = self._fields.setdefault(field, field_value)
|
|
return field_value</code></pre>
|
|
</details>
|
|
</dd>
|
|
<dt id="meshtastic.deviceonly_pb2.DeviceState.my_node"><code class="name">var <span class="ident">my_node</span></code></dt>
|
|
<dd>
|
|
<div class="desc"><p>Getter for my_node.</p></div>
|
|
<details class="source">
|
|
<summary>
|
|
<span>Expand source code</span>
|
|
</summary>
|
|
<pre><code class="python">def getter(self):
|
|
field_value = self._fields.get(field)
|
|
if field_value is None:
|
|
# Construct a new object to represent this field.
|
|
field_value = field._default_constructor(self)
|
|
|
|
# Atomically check if another thread has preempted us and, if not, swap
|
|
# in the new object we just created. If someone has preempted us, we
|
|
# take that object and discard ours.
|
|
# WARNING: We are relying on setdefault() being atomic. This is true
|
|
# in CPython but we haven't investigated others. This warning appears
|
|
# in several other locations in this file.
|
|
field_value = self._fields.setdefault(field, field_value)
|
|
return field_value</code></pre>
|
|
</details>
|
|
</dd>
|
|
<dt id="meshtastic.deviceonly_pb2.DeviceState.no_save"><code class="name">var <span class="ident">no_save</span></code></dt>
|
|
<dd>
|
|
<div class="desc"><p>Getter for no_save.</p></div>
|
|
<details class="source">
|
|
<summary>
|
|
<span>Expand source code</span>
|
|
</summary>
|
|
<pre><code class="python">def getter(self):
|
|
# TODO(protobuf-team): This may be broken since there may not be
|
|
# default_value. Combine with has_default_value somehow.
|
|
return self._fields.get(field, default_value)</code></pre>
|
|
</details>
|
|
</dd>
|
|
<dt id="meshtastic.deviceonly_pb2.DeviceState.node_db"><code class="name">var <span class="ident">node_db</span></code></dt>
|
|
<dd>
|
|
<div class="desc"><p>Getter for node_db.</p></div>
|
|
<details class="source">
|
|
<summary>
|
|
<span>Expand source code</span>
|
|
</summary>
|
|
<pre><code class="python">def getter(self):
|
|
field_value = self._fields.get(field)
|
|
if field_value is None:
|
|
# Construct a new object to represent this field.
|
|
field_value = field._default_constructor(self)
|
|
|
|
# Atomically check if another thread has preempted us and, if not, swap
|
|
# in the new object we just created. If someone has preempted us, we
|
|
# take that object and discard ours.
|
|
# WARNING: We are relying on setdefault() being atomic. This is true
|
|
# in CPython but we haven't investigated others. This warning appears
|
|
# in several other locations in this file.
|
|
field_value = self._fields.setdefault(field, field_value)
|
|
return field_value</code></pre>
|
|
</details>
|
|
</dd>
|
|
<dt id="meshtastic.deviceonly_pb2.DeviceState.owner"><code class="name">var <span class="ident">owner</span></code></dt>
|
|
<dd>
|
|
<div class="desc"><p>Getter for owner.</p></div>
|
|
<details class="source">
|
|
<summary>
|
|
<span>Expand source code</span>
|
|
</summary>
|
|
<pre><code class="python">def getter(self):
|
|
field_value = self._fields.get(field)
|
|
if field_value is None:
|
|
# Construct a new object to represent this field.
|
|
field_value = field._default_constructor(self)
|
|
|
|
# Atomically check if another thread has preempted us and, if not, swap
|
|
# in the new object we just created. If someone has preempted us, we
|
|
# take that object and discard ours.
|
|
# WARNING: We are relying on setdefault() being atomic. This is true
|
|
# in CPython but we haven't investigated others. This warning appears
|
|
# in several other locations in this file.
|
|
field_value = self._fields.setdefault(field, field_value)
|
|
return field_value</code></pre>
|
|
</details>
|
|
</dd>
|
|
<dt id="meshtastic.deviceonly_pb2.DeviceState.receive_queue"><code class="name">var <span class="ident">receive_queue</span></code></dt>
|
|
<dd>
|
|
<div class="desc"><p>Getter for receive_queue.</p></div>
|
|
<details class="source">
|
|
<summary>
|
|
<span>Expand source code</span>
|
|
</summary>
|
|
<pre><code class="python">def getter(self):
|
|
field_value = self._fields.get(field)
|
|
if field_value is None:
|
|
# Construct a new object to represent this field.
|
|
field_value = field._default_constructor(self)
|
|
|
|
# Atomically check if another thread has preempted us and, if not, swap
|
|
# in the new object we just created. If someone has preempted us, we
|
|
# take that object and discard ours.
|
|
# WARNING: We are relying on setdefault() being atomic. This is true
|
|
# in CPython but we haven't investigated others. This warning appears
|
|
# in several other locations in this file.
|
|
field_value = self._fields.setdefault(field, field_value)
|
|
return field_value</code></pre>
|
|
</details>
|
|
</dd>
|
|
<dt id="meshtastic.deviceonly_pb2.DeviceState.rx_text_message"><code class="name">var <span class="ident">rx_text_message</span></code></dt>
|
|
<dd>
|
|
<div class="desc"><p>Getter for rx_text_message.</p></div>
|
|
<details class="source">
|
|
<summary>
|
|
<span>Expand source code</span>
|
|
</summary>
|
|
<pre><code class="python">def getter(self):
|
|
field_value = self._fields.get(field)
|
|
if field_value is None:
|
|
# Construct a new object to represent this field.
|
|
field_value = field._default_constructor(self)
|
|
|
|
# Atomically check if another thread has preempted us and, if not, swap
|
|
# in the new object we just created. If someone has preempted us, we
|
|
# take that object and discard ours.
|
|
# WARNING: We are relying on setdefault() being atomic. This is true
|
|
# in CPython but we haven't investigated others. This warning appears
|
|
# in several other locations in this file.
|
|
field_value = self._fields.setdefault(field, field_value)
|
|
return field_value</code></pre>
|
|
</details>
|
|
</dd>
|
|
<dt id="meshtastic.deviceonly_pb2.DeviceState.version"><code class="name">var <span class="ident">version</span></code></dt>
|
|
<dd>
|
|
<div class="desc"><p>Getter for version.</p></div>
|
|
<details class="source">
|
|
<summary>
|
|
<span>Expand source code</span>
|
|
</summary>
|
|
<pre><code class="python">def getter(self):
|
|
# TODO(protobuf-team): This may be broken since there may not be
|
|
# default_value. Combine with has_default_value somehow.
|
|
return self._fields.get(field, default_value)</code></pre>
|
|
</details>
|
|
</dd>
|
|
</dl>
|
|
<h3>Methods</h3>
|
|
<dl>
|
|
<dt id="meshtastic.deviceonly_pb2.DeviceState.ByteSize"><code class="name flex">
|
|
<span>def <span class="ident">ByteSize</span></span>(<span>self)</span>
|
|
</code></dt>
|
|
<dd>
|
|
<div class="desc"></div>
|
|
<details class="source">
|
|
<summary>
|
|
<span>Expand source code</span>
|
|
</summary>
|
|
<pre><code class="python">def ByteSize(self):
|
|
if not self._cached_byte_size_dirty:
|
|
return self._cached_byte_size
|
|
|
|
size = 0
|
|
descriptor = self.DESCRIPTOR
|
|
if descriptor.GetOptions().map_entry:
|
|
# Fields of map entry should always be serialized.
|
|
size = descriptor.fields_by_name['key']._sizer(self.key)
|
|
size += descriptor.fields_by_name['value']._sizer(self.value)
|
|
else:
|
|
for field_descriptor, field_value in self.ListFields():
|
|
size += field_descriptor._sizer(field_value)
|
|
for tag_bytes, value_bytes in self._unknown_fields:
|
|
size += len(tag_bytes) + len(value_bytes)
|
|
|
|
self._cached_byte_size = size
|
|
self._cached_byte_size_dirty = False
|
|
self._listener_for_children.dirty = False
|
|
return size</code></pre>
|
|
</details>
|
|
</dd>
|
|
<dt id="meshtastic.deviceonly_pb2.DeviceState.Clear"><code class="name flex">
|
|
<span>def <span class="ident">Clear</span></span>(<span>self)</span>
|
|
</code></dt>
|
|
<dd>
|
|
<div class="desc"></div>
|
|
<details class="source">
|
|
<summary>
|
|
<span>Expand source code</span>
|
|
</summary>
|
|
<pre><code class="python">def _Clear(self):
|
|
# Clear fields.
|
|
self._fields = {}
|
|
self._unknown_fields = ()
|
|
# pylint: disable=protected-access
|
|
if self._unknown_field_set is not None:
|
|
self._unknown_field_set._clear()
|
|
self._unknown_field_set = None
|
|
|
|
self._oneofs = {}
|
|
self._Modified()</code></pre>
|
|
</details>
|
|
</dd>
|
|
<dt id="meshtastic.deviceonly_pb2.DeviceState.ClearField"><code class="name flex">
|
|
<span>def <span class="ident">ClearField</span></span>(<span>self, field_name)</span>
|
|
</code></dt>
|
|
<dd>
|
|
<div class="desc"></div>
|
|
<details class="source">
|
|
<summary>
|
|
<span>Expand source code</span>
|
|
</summary>
|
|
<pre><code class="python">def ClearField(self, field_name):
|
|
try:
|
|
field = message_descriptor.fields_by_name[field_name]
|
|
except KeyError:
|
|
try:
|
|
field = message_descriptor.oneofs_by_name[field_name]
|
|
if field in self._oneofs:
|
|
field = self._oneofs[field]
|
|
else:
|
|
return
|
|
except KeyError:
|
|
raise ValueError('Protocol message %s has no "%s" field.' %
|
|
(message_descriptor.name, field_name))
|
|
|
|
if field in self._fields:
|
|
# To match the C++ implementation, we need to invalidate iterators
|
|
# for map fields when ClearField() happens.
|
|
if hasattr(self._fields[field], 'InvalidateIterators'):
|
|
self._fields[field].InvalidateIterators()
|
|
|
|
# Note: If the field is a sub-message, its listener will still point
|
|
# at us. That's fine, because the worst than can happen is that it
|
|
# will call _Modified() and invalidate our byte size. Big deal.
|
|
del self._fields[field]
|
|
|
|
if self._oneofs.get(field.containing_oneof, None) is field:
|
|
del self._oneofs[field.containing_oneof]
|
|
|
|
# Always call _Modified() -- even if nothing was changed, this is
|
|
# a mutating method, and thus calling it should cause the field to become
|
|
# present in the parent message.
|
|
self._Modified()</code></pre>
|
|
</details>
|
|
</dd>
|
|
<dt id="meshtastic.deviceonly_pb2.DeviceState.DiscardUnknownFields"><code class="name flex">
|
|
<span>def <span class="ident">DiscardUnknownFields</span></span>(<span>self)</span>
|
|
</code></dt>
|
|
<dd>
|
|
<div class="desc"></div>
|
|
<details class="source">
|
|
<summary>
|
|
<span>Expand source code</span>
|
|
</summary>
|
|
<pre><code class="python">def _DiscardUnknownFields(self):
|
|
self._unknown_fields = []
|
|
self._unknown_field_set = None # pylint: disable=protected-access
|
|
for field, value in self.ListFields():
|
|
if field.cpp_type == _FieldDescriptor.CPPTYPE_MESSAGE:
|
|
if _IsMapField(field):
|
|
if _IsMessageMapField(field):
|
|
for key in value:
|
|
value[key].DiscardUnknownFields()
|
|
elif field.label == _FieldDescriptor.LABEL_REPEATED:
|
|
for sub_message in value:
|
|
sub_message.DiscardUnknownFields()
|
|
else:
|
|
value.DiscardUnknownFields()</code></pre>
|
|
</details>
|
|
</dd>
|
|
<dt id="meshtastic.deviceonly_pb2.DeviceState.FindInitializationErrors"><code class="name flex">
|
|
<span>def <span class="ident">FindInitializationErrors</span></span>(<span>self)</span>
|
|
</code></dt>
|
|
<dd>
|
|
<div class="desc"><p>Finds required fields which are not initialized.</p>
|
|
<h2 id="returns">Returns</h2>
|
|
<p>A list of strings.
|
|
Each string is a path to an uninitialized field from
|
|
the top-level message, e.g. "foo.bar[5].baz".</p></div>
|
|
<details class="source">
|
|
<summary>
|
|
<span>Expand source code</span>
|
|
</summary>
|
|
<pre><code class="python">def FindInitializationErrors(self):
|
|
"""Finds required fields which are not initialized.
|
|
|
|
Returns:
|
|
A list of strings. Each string is a path to an uninitialized field from
|
|
the top-level message, e.g. "foo.bar[5].baz".
|
|
"""
|
|
|
|
errors = [] # simplify things
|
|
|
|
for field in required_fields:
|
|
if not self.HasField(field.name):
|
|
errors.append(field.name)
|
|
|
|
for field, value in self.ListFields():
|
|
if field.cpp_type == _FieldDescriptor.CPPTYPE_MESSAGE:
|
|
if field.is_extension:
|
|
name = '(%s)' % field.full_name
|
|
else:
|
|
name = field.name
|
|
|
|
if _IsMapField(field):
|
|
if _IsMessageMapField(field):
|
|
for key in value:
|
|
element = value[key]
|
|
prefix = '%s[%s].' % (name, key)
|
|
sub_errors = element.FindInitializationErrors()
|
|
errors += [prefix + error for error in sub_errors]
|
|
else:
|
|
# ScalarMaps can't have any initialization errors.
|
|
pass
|
|
elif field.label == _FieldDescriptor.LABEL_REPEATED:
|
|
for i in range(len(value)):
|
|
element = value[i]
|
|
prefix = '%s[%d].' % (name, i)
|
|
sub_errors = element.FindInitializationErrors()
|
|
errors += [prefix + error for error in sub_errors]
|
|
else:
|
|
prefix = name + '.'
|
|
sub_errors = value.FindInitializationErrors()
|
|
errors += [prefix + error for error in sub_errors]
|
|
|
|
return errors</code></pre>
|
|
</details>
|
|
</dd>
|
|
<dt id="meshtastic.deviceonly_pb2.DeviceState.HasField"><code class="name flex">
|
|
<span>def <span class="ident">HasField</span></span>(<span>self, field_name)</span>
|
|
</code></dt>
|
|
<dd>
|
|
<div class="desc"></div>
|
|
<details class="source">
|
|
<summary>
|
|
<span>Expand source code</span>
|
|
</summary>
|
|
<pre><code class="python">def HasField(self, field_name):
|
|
try:
|
|
field = hassable_fields[field_name]
|
|
except KeyError:
|
|
raise ValueError(error_msg % (message_descriptor.full_name, field_name))
|
|
|
|
if isinstance(field, descriptor_mod.OneofDescriptor):
|
|
try:
|
|
return HasField(self, self._oneofs[field].name)
|
|
except KeyError:
|
|
return False
|
|
else:
|
|
if field.cpp_type == _FieldDescriptor.CPPTYPE_MESSAGE:
|
|
value = self._fields.get(field)
|
|
return value is not None and value._is_present_in_parent
|
|
else:
|
|
return field in self._fields</code></pre>
|
|
</details>
|
|
</dd>
|
|
<dt id="meshtastic.deviceonly_pb2.DeviceState.IsInitialized"><code class="name flex">
|
|
<span>def <span class="ident">IsInitialized</span></span>(<span>self, errors=None)</span>
|
|
</code></dt>
|
|
<dd>
|
|
<div class="desc"><p>Checks if all required fields of a message are set.</p>
|
|
<h2 id="args">Args</h2>
|
|
<dl>
|
|
<dt><strong><code>errors</code></strong></dt>
|
|
<dd>A list which, if provided, will be populated with the field
|
|
paths of all missing required fields.</dd>
|
|
</dl>
|
|
<h2 id="returns">Returns</h2>
|
|
<p>True iff the specified message has all required fields set.</p></div>
|
|
<details class="source">
|
|
<summary>
|
|
<span>Expand source code</span>
|
|
</summary>
|
|
<pre><code class="python">def IsInitialized(self, errors=None):
|
|
"""Checks if all required fields of a message are set.
|
|
|
|
Args:
|
|
errors: A list which, if provided, will be populated with the field
|
|
paths of all missing required fields.
|
|
|
|
Returns:
|
|
True iff the specified message has all required fields set.
|
|
"""
|
|
|
|
# Performance is critical so we avoid HasField() and ListFields().
|
|
|
|
for field in required_fields:
|
|
if (field not in self._fields or
|
|
(field.cpp_type == _FieldDescriptor.CPPTYPE_MESSAGE and
|
|
not self._fields[field]._is_present_in_parent)):
|
|
if errors is not None:
|
|
errors.extend(self.FindInitializationErrors())
|
|
return False
|
|
|
|
for field, value in list(self._fields.items()): # dict can change size!
|
|
if field.cpp_type == _FieldDescriptor.CPPTYPE_MESSAGE:
|
|
if field.label == _FieldDescriptor.LABEL_REPEATED:
|
|
if (field.message_type.has_options and
|
|
field.message_type.GetOptions().map_entry):
|
|
continue
|
|
for element in value:
|
|
if not element.IsInitialized():
|
|
if errors is not None:
|
|
errors.extend(self.FindInitializationErrors())
|
|
return False
|
|
elif value._is_present_in_parent and not value.IsInitialized():
|
|
if errors is not None:
|
|
errors.extend(self.FindInitializationErrors())
|
|
return False
|
|
|
|
return True</code></pre>
|
|
</details>
|
|
</dd>
|
|
<dt id="meshtastic.deviceonly_pb2.DeviceState.ListFields"><code class="name flex">
|
|
<span>def <span class="ident">ListFields</span></span>(<span>self)</span>
|
|
</code></dt>
|
|
<dd>
|
|
<div class="desc"></div>
|
|
<details class="source">
|
|
<summary>
|
|
<span>Expand source code</span>
|
|
</summary>
|
|
<pre><code class="python">def ListFields(self):
|
|
all_fields = [item for item in self._fields.items() if _IsPresent(item)]
|
|
all_fields.sort(key = lambda item: item[0].number)
|
|
return all_fields</code></pre>
|
|
</details>
|
|
</dd>
|
|
<dt id="meshtastic.deviceonly_pb2.DeviceState.MergeFrom"><code class="name flex">
|
|
<span>def <span class="ident">MergeFrom</span></span>(<span>self, msg)</span>
|
|
</code></dt>
|
|
<dd>
|
|
<div class="desc"></div>
|
|
<details class="source">
|
|
<summary>
|
|
<span>Expand source code</span>
|
|
</summary>
|
|
<pre><code class="python">def MergeFrom(self, msg):
|
|
if not isinstance(msg, cls):
|
|
raise TypeError(
|
|
'Parameter to MergeFrom() must be instance of same class: '
|
|
'expected %s got %s.' % (_FullyQualifiedClassName(cls),
|
|
_FullyQualifiedClassName(msg.__class__)))
|
|
|
|
assert msg is not self
|
|
self._Modified()
|
|
|
|
fields = self._fields
|
|
|
|
for field, value in msg._fields.items():
|
|
if field.label == LABEL_REPEATED:
|
|
field_value = fields.get(field)
|
|
if field_value is None:
|
|
# Construct a new object to represent this field.
|
|
field_value = field._default_constructor(self)
|
|
fields[field] = field_value
|
|
field_value.MergeFrom(value)
|
|
elif field.cpp_type == CPPTYPE_MESSAGE:
|
|
if value._is_present_in_parent:
|
|
field_value = fields.get(field)
|
|
if field_value is None:
|
|
# Construct a new object to represent this field.
|
|
field_value = field._default_constructor(self)
|
|
fields[field] = field_value
|
|
field_value.MergeFrom(value)
|
|
else:
|
|
self._fields[field] = value
|
|
if field.containing_oneof:
|
|
self._UpdateOneofState(field)
|
|
|
|
if msg._unknown_fields:
|
|
if not self._unknown_fields:
|
|
self._unknown_fields = []
|
|
self._unknown_fields.extend(msg._unknown_fields)
|
|
# pylint: disable=protected-access
|
|
if self._unknown_field_set is None:
|
|
self._unknown_field_set = containers.UnknownFieldSet()
|
|
self._unknown_field_set._extend(msg._unknown_field_set)</code></pre>
|
|
</details>
|
|
</dd>
|
|
<dt id="meshtastic.deviceonly_pb2.DeviceState.MergeFromString"><code class="name flex">
|
|
<span>def <span class="ident">MergeFromString</span></span>(<span>self, serialized)</span>
|
|
</code></dt>
|
|
<dd>
|
|
<div class="desc"></div>
|
|
<details class="source">
|
|
<summary>
|
|
<span>Expand source code</span>
|
|
</summary>
|
|
<pre><code class="python">def MergeFromString(self, serialized):
|
|
serialized = memoryview(serialized)
|
|
length = len(serialized)
|
|
try:
|
|
if self._InternalParse(serialized, 0, length) != length:
|
|
# The only reason _InternalParse would return early is if it
|
|
# encountered an end-group tag.
|
|
raise message_mod.DecodeError('Unexpected end-group tag.')
|
|
except (IndexError, TypeError):
|
|
# Now ord(buf[p:p+1]) == ord('') gets TypeError.
|
|
raise message_mod.DecodeError('Truncated message.')
|
|
except struct.error as e:
|
|
raise message_mod.DecodeError(e)
|
|
return length # Return this for legacy reasons.</code></pre>
|
|
</details>
|
|
</dd>
|
|
<dt id="meshtastic.deviceonly_pb2.DeviceState.SerializePartialToString"><code class="name flex">
|
|
<span>def <span class="ident">SerializePartialToString</span></span>(<span>self, **kwargs)</span>
|
|
</code></dt>
|
|
<dd>
|
|
<div class="desc"></div>
|
|
<details class="source">
|
|
<summary>
|
|
<span>Expand source code</span>
|
|
</summary>
|
|
<pre><code class="python">def SerializePartialToString(self, **kwargs):
|
|
out = BytesIO()
|
|
self._InternalSerialize(out.write, **kwargs)
|
|
return out.getvalue()</code></pre>
|
|
</details>
|
|
</dd>
|
|
<dt id="meshtastic.deviceonly_pb2.DeviceState.SerializeToString"><code class="name flex">
|
|
<span>def <span class="ident">SerializeToString</span></span>(<span>self, **kwargs)</span>
|
|
</code></dt>
|
|
<dd>
|
|
<div class="desc"></div>
|
|
<details class="source">
|
|
<summary>
|
|
<span>Expand source code</span>
|
|
</summary>
|
|
<pre><code class="python">def SerializeToString(self, **kwargs):
|
|
# Check if the message has all of its required fields set.
|
|
if not self.IsInitialized():
|
|
raise message_mod.EncodeError(
|
|
'Message %s is missing required fields: %s' % (
|
|
self.DESCRIPTOR.full_name, ','.join(self.FindInitializationErrors())))
|
|
return self.SerializePartialToString(**kwargs)</code></pre>
|
|
</details>
|
|
</dd>
|
|
<dt id="meshtastic.deviceonly_pb2.DeviceState.SetInParent"><code class="name flex">
|
|
<span>def <span class="ident">SetInParent</span></span>(<span>self)</span>
|
|
</code></dt>
|
|
<dd>
|
|
<div class="desc"><p>Sets the _cached_byte_size_dirty bit to true,
|
|
and propagates this to our listener iff this was a state change.</p></div>
|
|
<details class="source">
|
|
<summary>
|
|
<span>Expand source code</span>
|
|
</summary>
|
|
<pre><code class="python">def Modified(self):
|
|
"""Sets the _cached_byte_size_dirty bit to true,
|
|
and propagates this to our listener iff this was a state change.
|
|
"""
|
|
|
|
# Note: Some callers check _cached_byte_size_dirty before calling
|
|
# _Modified() as an extra optimization. So, if this method is ever
|
|
# changed such that it does stuff even when _cached_byte_size_dirty is
|
|
# already true, the callers need to be updated.
|
|
if not self._cached_byte_size_dirty:
|
|
self._cached_byte_size_dirty = True
|
|
self._listener_for_children.dirty = True
|
|
self._is_present_in_parent = True
|
|
self._listener.Modified()</code></pre>
|
|
</details>
|
|
</dd>
|
|
<dt id="meshtastic.deviceonly_pb2.DeviceState.UnknownFields"><code class="name flex">
|
|
<span>def <span class="ident">UnknownFields</span></span>(<span>self)</span>
|
|
</code></dt>
|
|
<dd>
|
|
<div class="desc"></div>
|
|
<details class="source">
|
|
<summary>
|
|
<span>Expand source code</span>
|
|
</summary>
|
|
<pre><code class="python">def _UnknownFields(self):
|
|
if self._unknown_field_set is None: # pylint: disable=protected-access
|
|
# pylint: disable=protected-access
|
|
self._unknown_field_set = containers.UnknownFieldSet()
|
|
return self._unknown_field_set # pylint: disable=protected-access</code></pre>
|
|
</details>
|
|
</dd>
|
|
<dt id="meshtastic.deviceonly_pb2.DeviceState.WhichOneof"><code class="name flex">
|
|
<span>def <span class="ident">WhichOneof</span></span>(<span>self, oneof_name)</span>
|
|
</code></dt>
|
|
<dd>
|
|
<div class="desc"><p>Returns the name of the currently set field inside a oneof, or None.</p></div>
|
|
<details class="source">
|
|
<summary>
|
|
<span>Expand source code</span>
|
|
</summary>
|
|
<pre><code class="python">def WhichOneof(self, oneof_name):
|
|
"""Returns the name of the currently set field inside a oneof, or None."""
|
|
try:
|
|
field = message_descriptor.oneofs_by_name[oneof_name]
|
|
except KeyError:
|
|
raise ValueError(
|
|
'Protocol message has no oneof "%s" field.' % oneof_name)
|
|
|
|
nested_field = self._oneofs.get(field, None)
|
|
if nested_field is not None and self.HasField(nested_field.name):
|
|
return nested_field.name
|
|
else:
|
|
return None</code></pre>
|
|
</details>
|
|
</dd>
|
|
</dl>
|
|
</dd>
|
|
<dt id="meshtastic.deviceonly_pb2.LegacyRadioConfig"><code class="flex name class">
|
|
<span>class <span class="ident">LegacyRadioConfig</span></span>
|
|
<span>(</span><span>**kwargs)</span>
|
|
</code></dt>
|
|
<dd>
|
|
<div class="desc"><p>Abstract base class for protocol messages.</p>
|
|
<p>Protocol message classes are almost always generated by the protocol
|
|
compiler.
|
|
These generated types subclass Message and implement the methods
|
|
shown below.</p></div>
|
|
<h3>Ancestors</h3>
|
|
<ul class="hlist">
|
|
<li>google.protobuf.message.Message</li>
|
|
</ul>
|
|
<h3>Class variables</h3>
|
|
<dl>
|
|
<dt id="meshtastic.deviceonly_pb2.LegacyRadioConfig.DESCRIPTOR"><code class="name">var <span class="ident">DESCRIPTOR</span></code></dt>
|
|
<dd>
|
|
<div class="desc"></div>
|
|
</dd>
|
|
<dt id="meshtastic.deviceonly_pb2.LegacyRadioConfig.LegacyPreferences"><code class="name">var <span class="ident">LegacyPreferences</span></code></dt>
|
|
<dd>
|
|
<div class="desc"><p>Abstract base class for protocol messages.</p>
|
|
<p>Protocol message classes are almost always generated by the protocol
|
|
compiler.
|
|
These generated types subclass Message and implement the methods
|
|
shown below.</p></div>
|
|
</dd>
|
|
<dt id="meshtastic.deviceonly_pb2.LegacyRadioConfig.PREFERENCES_FIELD_NUMBER"><code class="name">var <span class="ident">PREFERENCES_FIELD_NUMBER</span></code></dt>
|
|
<dd>
|
|
<div class="desc"></div>
|
|
</dd>
|
|
</dl>
|
|
<h3>Static methods</h3>
|
|
<dl>
|
|
<dt id="meshtastic.deviceonly_pb2.LegacyRadioConfig.FromString"><code class="name flex">
|
|
<span>def <span class="ident">FromString</span></span>(<span>s)</span>
|
|
</code></dt>
|
|
<dd>
|
|
<div class="desc"></div>
|
|
<details class="source">
|
|
<summary>
|
|
<span>Expand source code</span>
|
|
</summary>
|
|
<pre><code class="python">def FromString(s):
|
|
message = cls()
|
|
message.MergeFromString(s)
|
|
return message</code></pre>
|
|
</details>
|
|
</dd>
|
|
<dt id="meshtastic.deviceonly_pb2.LegacyRadioConfig.RegisterExtension"><code class="name flex">
|
|
<span>def <span class="ident">RegisterExtension</span></span>(<span>extension_handle)</span>
|
|
</code></dt>
|
|
<dd>
|
|
<div class="desc"></div>
|
|
<details class="source">
|
|
<summary>
|
|
<span>Expand source code</span>
|
|
</summary>
|
|
<pre><code class="python">def RegisterExtension(extension_handle):
|
|
extension_handle.containing_type = cls.DESCRIPTOR
|
|
# TODO(amauryfa): Use cls.MESSAGE_FACTORY.pool when available.
|
|
# pylint: disable=protected-access
|
|
cls.DESCRIPTOR.file.pool._AddExtensionDescriptor(extension_handle)
|
|
_AttachFieldHelpers(cls, extension_handle)</code></pre>
|
|
</details>
|
|
</dd>
|
|
</dl>
|
|
<h3>Instance variables</h3>
|
|
<dl>
|
|
<dt id="meshtastic.deviceonly_pb2.LegacyRadioConfig.preferences"><code class="name">var <span class="ident">preferences</span></code></dt>
|
|
<dd>
|
|
<div class="desc"><p>Getter for preferences.</p></div>
|
|
<details class="source">
|
|
<summary>
|
|
<span>Expand source code</span>
|
|
</summary>
|
|
<pre><code class="python">def getter(self):
|
|
field_value = self._fields.get(field)
|
|
if field_value is None:
|
|
# Construct a new object to represent this field.
|
|
field_value = field._default_constructor(self)
|
|
|
|
# Atomically check if another thread has preempted us and, if not, swap
|
|
# in the new object we just created. If someone has preempted us, we
|
|
# take that object and discard ours.
|
|
# WARNING: We are relying on setdefault() being atomic. This is true
|
|
# in CPython but we haven't investigated others. This warning appears
|
|
# in several other locations in this file.
|
|
field_value = self._fields.setdefault(field, field_value)
|
|
return field_value</code></pre>
|
|
</details>
|
|
</dd>
|
|
</dl>
|
|
<h3>Methods</h3>
|
|
<dl>
|
|
<dt id="meshtastic.deviceonly_pb2.LegacyRadioConfig.ByteSize"><code class="name flex">
|
|
<span>def <span class="ident">ByteSize</span></span>(<span>self)</span>
|
|
</code></dt>
|
|
<dd>
|
|
<div class="desc"></div>
|
|
<details class="source">
|
|
<summary>
|
|
<span>Expand source code</span>
|
|
</summary>
|
|
<pre><code class="python">def ByteSize(self):
|
|
if not self._cached_byte_size_dirty:
|
|
return self._cached_byte_size
|
|
|
|
size = 0
|
|
descriptor = self.DESCRIPTOR
|
|
if descriptor.GetOptions().map_entry:
|
|
# Fields of map entry should always be serialized.
|
|
size = descriptor.fields_by_name['key']._sizer(self.key)
|
|
size += descriptor.fields_by_name['value']._sizer(self.value)
|
|
else:
|
|
for field_descriptor, field_value in self.ListFields():
|
|
size += field_descriptor._sizer(field_value)
|
|
for tag_bytes, value_bytes in self._unknown_fields:
|
|
size += len(tag_bytes) + len(value_bytes)
|
|
|
|
self._cached_byte_size = size
|
|
self._cached_byte_size_dirty = False
|
|
self._listener_for_children.dirty = False
|
|
return size</code></pre>
|
|
</details>
|
|
</dd>
|
|
<dt id="meshtastic.deviceonly_pb2.LegacyRadioConfig.Clear"><code class="name flex">
|
|
<span>def <span class="ident">Clear</span></span>(<span>self)</span>
|
|
</code></dt>
|
|
<dd>
|
|
<div class="desc"></div>
|
|
<details class="source">
|
|
<summary>
|
|
<span>Expand source code</span>
|
|
</summary>
|
|
<pre><code class="python">def _Clear(self):
|
|
# Clear fields.
|
|
self._fields = {}
|
|
self._unknown_fields = ()
|
|
# pylint: disable=protected-access
|
|
if self._unknown_field_set is not None:
|
|
self._unknown_field_set._clear()
|
|
self._unknown_field_set = None
|
|
|
|
self._oneofs = {}
|
|
self._Modified()</code></pre>
|
|
</details>
|
|
</dd>
|
|
<dt id="meshtastic.deviceonly_pb2.LegacyRadioConfig.ClearField"><code class="name flex">
|
|
<span>def <span class="ident">ClearField</span></span>(<span>self, field_name)</span>
|
|
</code></dt>
|
|
<dd>
|
|
<div class="desc"></div>
|
|
<details class="source">
|
|
<summary>
|
|
<span>Expand source code</span>
|
|
</summary>
|
|
<pre><code class="python">def ClearField(self, field_name):
|
|
try:
|
|
field = message_descriptor.fields_by_name[field_name]
|
|
except KeyError:
|
|
try:
|
|
field = message_descriptor.oneofs_by_name[field_name]
|
|
if field in self._oneofs:
|
|
field = self._oneofs[field]
|
|
else:
|
|
return
|
|
except KeyError:
|
|
raise ValueError('Protocol message %s has no "%s" field.' %
|
|
(message_descriptor.name, field_name))
|
|
|
|
if field in self._fields:
|
|
# To match the C++ implementation, we need to invalidate iterators
|
|
# for map fields when ClearField() happens.
|
|
if hasattr(self._fields[field], 'InvalidateIterators'):
|
|
self._fields[field].InvalidateIterators()
|
|
|
|
# Note: If the field is a sub-message, its listener will still point
|
|
# at us. That's fine, because the worst than can happen is that it
|
|
# will call _Modified() and invalidate our byte size. Big deal.
|
|
del self._fields[field]
|
|
|
|
if self._oneofs.get(field.containing_oneof, None) is field:
|
|
del self._oneofs[field.containing_oneof]
|
|
|
|
# Always call _Modified() -- even if nothing was changed, this is
|
|
# a mutating method, and thus calling it should cause the field to become
|
|
# present in the parent message.
|
|
self._Modified()</code></pre>
|
|
</details>
|
|
</dd>
|
|
<dt id="meshtastic.deviceonly_pb2.LegacyRadioConfig.DiscardUnknownFields"><code class="name flex">
|
|
<span>def <span class="ident">DiscardUnknownFields</span></span>(<span>self)</span>
|
|
</code></dt>
|
|
<dd>
|
|
<div class="desc"></div>
|
|
<details class="source">
|
|
<summary>
|
|
<span>Expand source code</span>
|
|
</summary>
|
|
<pre><code class="python">def _DiscardUnknownFields(self):
|
|
self._unknown_fields = []
|
|
self._unknown_field_set = None # pylint: disable=protected-access
|
|
for field, value in self.ListFields():
|
|
if field.cpp_type == _FieldDescriptor.CPPTYPE_MESSAGE:
|
|
if _IsMapField(field):
|
|
if _IsMessageMapField(field):
|
|
for key in value:
|
|
value[key].DiscardUnknownFields()
|
|
elif field.label == _FieldDescriptor.LABEL_REPEATED:
|
|
for sub_message in value:
|
|
sub_message.DiscardUnknownFields()
|
|
else:
|
|
value.DiscardUnknownFields()</code></pre>
|
|
</details>
|
|
</dd>
|
|
<dt id="meshtastic.deviceonly_pb2.LegacyRadioConfig.FindInitializationErrors"><code class="name flex">
|
|
<span>def <span class="ident">FindInitializationErrors</span></span>(<span>self)</span>
|
|
</code></dt>
|
|
<dd>
|
|
<div class="desc"><p>Finds required fields which are not initialized.</p>
|
|
<h2 id="returns">Returns</h2>
|
|
<p>A list of strings.
|
|
Each string is a path to an uninitialized field from
|
|
the top-level message, e.g. "foo.bar[5].baz".</p></div>
|
|
<details class="source">
|
|
<summary>
|
|
<span>Expand source code</span>
|
|
</summary>
|
|
<pre><code class="python">def FindInitializationErrors(self):
|
|
"""Finds required fields which are not initialized.
|
|
|
|
Returns:
|
|
A list of strings. Each string is a path to an uninitialized field from
|
|
the top-level message, e.g. "foo.bar[5].baz".
|
|
"""
|
|
|
|
errors = [] # simplify things
|
|
|
|
for field in required_fields:
|
|
if not self.HasField(field.name):
|
|
errors.append(field.name)
|
|
|
|
for field, value in self.ListFields():
|
|
if field.cpp_type == _FieldDescriptor.CPPTYPE_MESSAGE:
|
|
if field.is_extension:
|
|
name = '(%s)' % field.full_name
|
|
else:
|
|
name = field.name
|
|
|
|
if _IsMapField(field):
|
|
if _IsMessageMapField(field):
|
|
for key in value:
|
|
element = value[key]
|
|
prefix = '%s[%s].' % (name, key)
|
|
sub_errors = element.FindInitializationErrors()
|
|
errors += [prefix + error for error in sub_errors]
|
|
else:
|
|
# ScalarMaps can't have any initialization errors.
|
|
pass
|
|
elif field.label == _FieldDescriptor.LABEL_REPEATED:
|
|
for i in range(len(value)):
|
|
element = value[i]
|
|
prefix = '%s[%d].' % (name, i)
|
|
sub_errors = element.FindInitializationErrors()
|
|
errors += [prefix + error for error in sub_errors]
|
|
else:
|
|
prefix = name + '.'
|
|
sub_errors = value.FindInitializationErrors()
|
|
errors += [prefix + error for error in sub_errors]
|
|
|
|
return errors</code></pre>
|
|
</details>
|
|
</dd>
|
|
<dt id="meshtastic.deviceonly_pb2.LegacyRadioConfig.HasField"><code class="name flex">
|
|
<span>def <span class="ident">HasField</span></span>(<span>self, field_name)</span>
|
|
</code></dt>
|
|
<dd>
|
|
<div class="desc"></div>
|
|
<details class="source">
|
|
<summary>
|
|
<span>Expand source code</span>
|
|
</summary>
|
|
<pre><code class="python">def HasField(self, field_name):
|
|
try:
|
|
field = hassable_fields[field_name]
|
|
except KeyError:
|
|
raise ValueError(error_msg % (message_descriptor.full_name, field_name))
|
|
|
|
if isinstance(field, descriptor_mod.OneofDescriptor):
|
|
try:
|
|
return HasField(self, self._oneofs[field].name)
|
|
except KeyError:
|
|
return False
|
|
else:
|
|
if field.cpp_type == _FieldDescriptor.CPPTYPE_MESSAGE:
|
|
value = self._fields.get(field)
|
|
return value is not None and value._is_present_in_parent
|
|
else:
|
|
return field in self._fields</code></pre>
|
|
</details>
|
|
</dd>
|
|
<dt id="meshtastic.deviceonly_pb2.LegacyRadioConfig.IsInitialized"><code class="name flex">
|
|
<span>def <span class="ident">IsInitialized</span></span>(<span>self, errors=None)</span>
|
|
</code></dt>
|
|
<dd>
|
|
<div class="desc"><p>Checks if all required fields of a message are set.</p>
|
|
<h2 id="args">Args</h2>
|
|
<dl>
|
|
<dt><strong><code>errors</code></strong></dt>
|
|
<dd>A list which, if provided, will be populated with the field
|
|
paths of all missing required fields.</dd>
|
|
</dl>
|
|
<h2 id="returns">Returns</h2>
|
|
<p>True iff the specified message has all required fields set.</p></div>
|
|
<details class="source">
|
|
<summary>
|
|
<span>Expand source code</span>
|
|
</summary>
|
|
<pre><code class="python">def IsInitialized(self, errors=None):
|
|
"""Checks if all required fields of a message are set.
|
|
|
|
Args:
|
|
errors: A list which, if provided, will be populated with the field
|
|
paths of all missing required fields.
|
|
|
|
Returns:
|
|
True iff the specified message has all required fields set.
|
|
"""
|
|
|
|
# Performance is critical so we avoid HasField() and ListFields().
|
|
|
|
for field in required_fields:
|
|
if (field not in self._fields or
|
|
(field.cpp_type == _FieldDescriptor.CPPTYPE_MESSAGE and
|
|
not self._fields[field]._is_present_in_parent)):
|
|
if errors is not None:
|
|
errors.extend(self.FindInitializationErrors())
|
|
return False
|
|
|
|
for field, value in list(self._fields.items()): # dict can change size!
|
|
if field.cpp_type == _FieldDescriptor.CPPTYPE_MESSAGE:
|
|
if field.label == _FieldDescriptor.LABEL_REPEATED:
|
|
if (field.message_type.has_options and
|
|
field.message_type.GetOptions().map_entry):
|
|
continue
|
|
for element in value:
|
|
if not element.IsInitialized():
|
|
if errors is not None:
|
|
errors.extend(self.FindInitializationErrors())
|
|
return False
|
|
elif value._is_present_in_parent and not value.IsInitialized():
|
|
if errors is not None:
|
|
errors.extend(self.FindInitializationErrors())
|
|
return False
|
|
|
|
return True</code></pre>
|
|
</details>
|
|
</dd>
|
|
<dt id="meshtastic.deviceonly_pb2.LegacyRadioConfig.ListFields"><code class="name flex">
|
|
<span>def <span class="ident">ListFields</span></span>(<span>self)</span>
|
|
</code></dt>
|
|
<dd>
|
|
<div class="desc"></div>
|
|
<details class="source">
|
|
<summary>
|
|
<span>Expand source code</span>
|
|
</summary>
|
|
<pre><code class="python">def ListFields(self):
|
|
all_fields = [item for item in self._fields.items() if _IsPresent(item)]
|
|
all_fields.sort(key = lambda item: item[0].number)
|
|
return all_fields</code></pre>
|
|
</details>
|
|
</dd>
|
|
<dt id="meshtastic.deviceonly_pb2.LegacyRadioConfig.MergeFrom"><code class="name flex">
|
|
<span>def <span class="ident">MergeFrom</span></span>(<span>self, msg)</span>
|
|
</code></dt>
|
|
<dd>
|
|
<div class="desc"></div>
|
|
<details class="source">
|
|
<summary>
|
|
<span>Expand source code</span>
|
|
</summary>
|
|
<pre><code class="python">def MergeFrom(self, msg):
|
|
if not isinstance(msg, cls):
|
|
raise TypeError(
|
|
'Parameter to MergeFrom() must be instance of same class: '
|
|
'expected %s got %s.' % (_FullyQualifiedClassName(cls),
|
|
_FullyQualifiedClassName(msg.__class__)))
|
|
|
|
assert msg is not self
|
|
self._Modified()
|
|
|
|
fields = self._fields
|
|
|
|
for field, value in msg._fields.items():
|
|
if field.label == LABEL_REPEATED:
|
|
field_value = fields.get(field)
|
|
if field_value is None:
|
|
# Construct a new object to represent this field.
|
|
field_value = field._default_constructor(self)
|
|
fields[field] = field_value
|
|
field_value.MergeFrom(value)
|
|
elif field.cpp_type == CPPTYPE_MESSAGE:
|
|
if value._is_present_in_parent:
|
|
field_value = fields.get(field)
|
|
if field_value is None:
|
|
# Construct a new object to represent this field.
|
|
field_value = field._default_constructor(self)
|
|
fields[field] = field_value
|
|
field_value.MergeFrom(value)
|
|
else:
|
|
self._fields[field] = value
|
|
if field.containing_oneof:
|
|
self._UpdateOneofState(field)
|
|
|
|
if msg._unknown_fields:
|
|
if not self._unknown_fields:
|
|
self._unknown_fields = []
|
|
self._unknown_fields.extend(msg._unknown_fields)
|
|
# pylint: disable=protected-access
|
|
if self._unknown_field_set is None:
|
|
self._unknown_field_set = containers.UnknownFieldSet()
|
|
self._unknown_field_set._extend(msg._unknown_field_set)</code></pre>
|
|
</details>
|
|
</dd>
|
|
<dt id="meshtastic.deviceonly_pb2.LegacyRadioConfig.MergeFromString"><code class="name flex">
|
|
<span>def <span class="ident">MergeFromString</span></span>(<span>self, serialized)</span>
|
|
</code></dt>
|
|
<dd>
|
|
<div class="desc"></div>
|
|
<details class="source">
|
|
<summary>
|
|
<span>Expand source code</span>
|
|
</summary>
|
|
<pre><code class="python">def MergeFromString(self, serialized):
|
|
serialized = memoryview(serialized)
|
|
length = len(serialized)
|
|
try:
|
|
if self._InternalParse(serialized, 0, length) != length:
|
|
# The only reason _InternalParse would return early is if it
|
|
# encountered an end-group tag.
|
|
raise message_mod.DecodeError('Unexpected end-group tag.')
|
|
except (IndexError, TypeError):
|
|
# Now ord(buf[p:p+1]) == ord('') gets TypeError.
|
|
raise message_mod.DecodeError('Truncated message.')
|
|
except struct.error as e:
|
|
raise message_mod.DecodeError(e)
|
|
return length # Return this for legacy reasons.</code></pre>
|
|
</details>
|
|
</dd>
|
|
<dt id="meshtastic.deviceonly_pb2.LegacyRadioConfig.SerializePartialToString"><code class="name flex">
|
|
<span>def <span class="ident">SerializePartialToString</span></span>(<span>self, **kwargs)</span>
|
|
</code></dt>
|
|
<dd>
|
|
<div class="desc"></div>
|
|
<details class="source">
|
|
<summary>
|
|
<span>Expand source code</span>
|
|
</summary>
|
|
<pre><code class="python">def SerializePartialToString(self, **kwargs):
|
|
out = BytesIO()
|
|
self._InternalSerialize(out.write, **kwargs)
|
|
return out.getvalue()</code></pre>
|
|
</details>
|
|
</dd>
|
|
<dt id="meshtastic.deviceonly_pb2.LegacyRadioConfig.SerializeToString"><code class="name flex">
|
|
<span>def <span class="ident">SerializeToString</span></span>(<span>self, **kwargs)</span>
|
|
</code></dt>
|
|
<dd>
|
|
<div class="desc"></div>
|
|
<details class="source">
|
|
<summary>
|
|
<span>Expand source code</span>
|
|
</summary>
|
|
<pre><code class="python">def SerializeToString(self, **kwargs):
|
|
# Check if the message has all of its required fields set.
|
|
if not self.IsInitialized():
|
|
raise message_mod.EncodeError(
|
|
'Message %s is missing required fields: %s' % (
|
|
self.DESCRIPTOR.full_name, ','.join(self.FindInitializationErrors())))
|
|
return self.SerializePartialToString(**kwargs)</code></pre>
|
|
</details>
|
|
</dd>
|
|
<dt id="meshtastic.deviceonly_pb2.LegacyRadioConfig.SetInParent"><code class="name flex">
|
|
<span>def <span class="ident">SetInParent</span></span>(<span>self)</span>
|
|
</code></dt>
|
|
<dd>
|
|
<div class="desc"><p>Sets the _cached_byte_size_dirty bit to true,
|
|
and propagates this to our listener iff this was a state change.</p></div>
|
|
<details class="source">
|
|
<summary>
|
|
<span>Expand source code</span>
|
|
</summary>
|
|
<pre><code class="python">def Modified(self):
|
|
"""Sets the _cached_byte_size_dirty bit to true,
|
|
and propagates this to our listener iff this was a state change.
|
|
"""
|
|
|
|
# Note: Some callers check _cached_byte_size_dirty before calling
|
|
# _Modified() as an extra optimization. So, if this method is ever
|
|
# changed such that it does stuff even when _cached_byte_size_dirty is
|
|
# already true, the callers need to be updated.
|
|
if not self._cached_byte_size_dirty:
|
|
self._cached_byte_size_dirty = True
|
|
self._listener_for_children.dirty = True
|
|
self._is_present_in_parent = True
|
|
self._listener.Modified()</code></pre>
|
|
</details>
|
|
</dd>
|
|
<dt id="meshtastic.deviceonly_pb2.LegacyRadioConfig.UnknownFields"><code class="name flex">
|
|
<span>def <span class="ident">UnknownFields</span></span>(<span>self)</span>
|
|
</code></dt>
|
|
<dd>
|
|
<div class="desc"></div>
|
|
<details class="source">
|
|
<summary>
|
|
<span>Expand source code</span>
|
|
</summary>
|
|
<pre><code class="python">def _UnknownFields(self):
|
|
if self._unknown_field_set is None: # pylint: disable=protected-access
|
|
# pylint: disable=protected-access
|
|
self._unknown_field_set = containers.UnknownFieldSet()
|
|
return self._unknown_field_set # pylint: disable=protected-access</code></pre>
|
|
</details>
|
|
</dd>
|
|
<dt id="meshtastic.deviceonly_pb2.LegacyRadioConfig.WhichOneof"><code class="name flex">
|
|
<span>def <span class="ident">WhichOneof</span></span>(<span>self, oneof_name)</span>
|
|
</code></dt>
|
|
<dd>
|
|
<div class="desc"><p>Returns the name of the currently set field inside a oneof, or None.</p></div>
|
|
<details class="source">
|
|
<summary>
|
|
<span>Expand source code</span>
|
|
</summary>
|
|
<pre><code class="python">def WhichOneof(self, oneof_name):
|
|
"""Returns the name of the currently set field inside a oneof, or None."""
|
|
try:
|
|
field = message_descriptor.oneofs_by_name[oneof_name]
|
|
except KeyError:
|
|
raise ValueError(
|
|
'Protocol message has no oneof "%s" field.' % oneof_name)
|
|
|
|
nested_field = self._oneofs.get(field, None)
|
|
if nested_field is not None and self.HasField(nested_field.name):
|
|
return nested_field.name
|
|
else:
|
|
return None</code></pre>
|
|
</details>
|
|
</dd>
|
|
</dl>
|
|
</dd>
|
|
</dl>
|
|
</section>
|
|
</article>
|
|
<nav id="sidebar">
|
|
<h1>Index</h1>
|
|
<div class="toc">
|
|
<ul></ul>
|
|
</div>
|
|
<ul id="index">
|
|
<li><h3>Super-module</h3>
|
|
<ul>
|
|
<li><code><a title="meshtastic" href="index.html">meshtastic</a></code></li>
|
|
</ul>
|
|
</li>
|
|
<li><h3><a href="#header-classes">Classes</a></h3>
|
|
<ul>
|
|
<li>
|
|
<h4><code><a title="meshtastic.deviceonly_pb2.ChannelFile" href="#meshtastic.deviceonly_pb2.ChannelFile">ChannelFile</a></code></h4>
|
|
<ul class="">
|
|
<li><code><a title="meshtastic.deviceonly_pb2.ChannelFile.ByteSize" href="#meshtastic.deviceonly_pb2.ChannelFile.ByteSize">ByteSize</a></code></li>
|
|
<li><code><a title="meshtastic.deviceonly_pb2.ChannelFile.CHANNELS_FIELD_NUMBER" href="#meshtastic.deviceonly_pb2.ChannelFile.CHANNELS_FIELD_NUMBER">CHANNELS_FIELD_NUMBER</a></code></li>
|
|
<li><code><a title="meshtastic.deviceonly_pb2.ChannelFile.Clear" href="#meshtastic.deviceonly_pb2.ChannelFile.Clear">Clear</a></code></li>
|
|
<li><code><a title="meshtastic.deviceonly_pb2.ChannelFile.ClearField" href="#meshtastic.deviceonly_pb2.ChannelFile.ClearField">ClearField</a></code></li>
|
|
<li><code><a title="meshtastic.deviceonly_pb2.ChannelFile.DESCRIPTOR" href="#meshtastic.deviceonly_pb2.ChannelFile.DESCRIPTOR">DESCRIPTOR</a></code></li>
|
|
<li><code><a title="meshtastic.deviceonly_pb2.ChannelFile.DiscardUnknownFields" href="#meshtastic.deviceonly_pb2.ChannelFile.DiscardUnknownFields">DiscardUnknownFields</a></code></li>
|
|
<li><code><a title="meshtastic.deviceonly_pb2.ChannelFile.FindInitializationErrors" href="#meshtastic.deviceonly_pb2.ChannelFile.FindInitializationErrors">FindInitializationErrors</a></code></li>
|
|
<li><code><a title="meshtastic.deviceonly_pb2.ChannelFile.FromString" href="#meshtastic.deviceonly_pb2.ChannelFile.FromString">FromString</a></code></li>
|
|
<li><code><a title="meshtastic.deviceonly_pb2.ChannelFile.HasField" href="#meshtastic.deviceonly_pb2.ChannelFile.HasField">HasField</a></code></li>
|
|
<li><code><a title="meshtastic.deviceonly_pb2.ChannelFile.IsInitialized" href="#meshtastic.deviceonly_pb2.ChannelFile.IsInitialized">IsInitialized</a></code></li>
|
|
<li><code><a title="meshtastic.deviceonly_pb2.ChannelFile.ListFields" href="#meshtastic.deviceonly_pb2.ChannelFile.ListFields">ListFields</a></code></li>
|
|
<li><code><a title="meshtastic.deviceonly_pb2.ChannelFile.MergeFrom" href="#meshtastic.deviceonly_pb2.ChannelFile.MergeFrom">MergeFrom</a></code></li>
|
|
<li><code><a title="meshtastic.deviceonly_pb2.ChannelFile.MergeFromString" href="#meshtastic.deviceonly_pb2.ChannelFile.MergeFromString">MergeFromString</a></code></li>
|
|
<li><code><a title="meshtastic.deviceonly_pb2.ChannelFile.RegisterExtension" href="#meshtastic.deviceonly_pb2.ChannelFile.RegisterExtension">RegisterExtension</a></code></li>
|
|
<li><code><a title="meshtastic.deviceonly_pb2.ChannelFile.SerializePartialToString" href="#meshtastic.deviceonly_pb2.ChannelFile.SerializePartialToString">SerializePartialToString</a></code></li>
|
|
<li><code><a title="meshtastic.deviceonly_pb2.ChannelFile.SerializeToString" href="#meshtastic.deviceonly_pb2.ChannelFile.SerializeToString">SerializeToString</a></code></li>
|
|
<li><code><a title="meshtastic.deviceonly_pb2.ChannelFile.SetInParent" href="#meshtastic.deviceonly_pb2.ChannelFile.SetInParent">SetInParent</a></code></li>
|
|
<li><code><a title="meshtastic.deviceonly_pb2.ChannelFile.UnknownFields" href="#meshtastic.deviceonly_pb2.ChannelFile.UnknownFields">UnknownFields</a></code></li>
|
|
<li><code><a title="meshtastic.deviceonly_pb2.ChannelFile.WhichOneof" href="#meshtastic.deviceonly_pb2.ChannelFile.WhichOneof">WhichOneof</a></code></li>
|
|
<li><code><a title="meshtastic.deviceonly_pb2.ChannelFile.channels" href="#meshtastic.deviceonly_pb2.ChannelFile.channels">channels</a></code></li>
|
|
</ul>
|
|
</li>
|
|
<li>
|
|
<h4><code><a title="meshtastic.deviceonly_pb2.DeviceState" href="#meshtastic.deviceonly_pb2.DeviceState">DeviceState</a></code></h4>
|
|
<ul class="">
|
|
<li><code><a title="meshtastic.deviceonly_pb2.DeviceState.ByteSize" href="#meshtastic.deviceonly_pb2.DeviceState.ByteSize">ByteSize</a></code></li>
|
|
<li><code><a title="meshtastic.deviceonly_pb2.DeviceState.Clear" href="#meshtastic.deviceonly_pb2.DeviceState.Clear">Clear</a></code></li>
|
|
<li><code><a title="meshtastic.deviceonly_pb2.DeviceState.ClearField" href="#meshtastic.deviceonly_pb2.DeviceState.ClearField">ClearField</a></code></li>
|
|
<li><code><a title="meshtastic.deviceonly_pb2.DeviceState.DESCRIPTOR" href="#meshtastic.deviceonly_pb2.DeviceState.DESCRIPTOR">DESCRIPTOR</a></code></li>
|
|
<li><code><a title="meshtastic.deviceonly_pb2.DeviceState.DID_GPS_RESET_FIELD_NUMBER" href="#meshtastic.deviceonly_pb2.DeviceState.DID_GPS_RESET_FIELD_NUMBER">DID_GPS_RESET_FIELD_NUMBER</a></code></li>
|
|
<li><code><a title="meshtastic.deviceonly_pb2.DeviceState.DiscardUnknownFields" href="#meshtastic.deviceonly_pb2.DeviceState.DiscardUnknownFields">DiscardUnknownFields</a></code></li>
|
|
<li><code><a title="meshtastic.deviceonly_pb2.DeviceState.FindInitializationErrors" href="#meshtastic.deviceonly_pb2.DeviceState.FindInitializationErrors">FindInitializationErrors</a></code></li>
|
|
<li><code><a title="meshtastic.deviceonly_pb2.DeviceState.FromString" href="#meshtastic.deviceonly_pb2.DeviceState.FromString">FromString</a></code></li>
|
|
<li><code><a title="meshtastic.deviceonly_pb2.DeviceState.HasField" href="#meshtastic.deviceonly_pb2.DeviceState.HasField">HasField</a></code></li>
|
|
<li><code><a title="meshtastic.deviceonly_pb2.DeviceState.IsInitialized" href="#meshtastic.deviceonly_pb2.DeviceState.IsInitialized">IsInitialized</a></code></li>
|
|
<li><code><a title="meshtastic.deviceonly_pb2.DeviceState.LEGACYRADIO_FIELD_NUMBER" href="#meshtastic.deviceonly_pb2.DeviceState.LEGACYRADIO_FIELD_NUMBER">LEGACYRADIO_FIELD_NUMBER</a></code></li>
|
|
<li><code><a title="meshtastic.deviceonly_pb2.DeviceState.ListFields" href="#meshtastic.deviceonly_pb2.DeviceState.ListFields">ListFields</a></code></li>
|
|
<li><code><a title="meshtastic.deviceonly_pb2.DeviceState.MY_NODE_FIELD_NUMBER" href="#meshtastic.deviceonly_pb2.DeviceState.MY_NODE_FIELD_NUMBER">MY_NODE_FIELD_NUMBER</a></code></li>
|
|
<li><code><a title="meshtastic.deviceonly_pb2.DeviceState.MergeFrom" href="#meshtastic.deviceonly_pb2.DeviceState.MergeFrom">MergeFrom</a></code></li>
|
|
<li><code><a title="meshtastic.deviceonly_pb2.DeviceState.MergeFromString" href="#meshtastic.deviceonly_pb2.DeviceState.MergeFromString">MergeFromString</a></code></li>
|
|
<li><code><a title="meshtastic.deviceonly_pb2.DeviceState.NODE_DB_FIELD_NUMBER" href="#meshtastic.deviceonly_pb2.DeviceState.NODE_DB_FIELD_NUMBER">NODE_DB_FIELD_NUMBER</a></code></li>
|
|
<li><code><a title="meshtastic.deviceonly_pb2.DeviceState.NO_SAVE_FIELD_NUMBER" href="#meshtastic.deviceonly_pb2.DeviceState.NO_SAVE_FIELD_NUMBER">NO_SAVE_FIELD_NUMBER</a></code></li>
|
|
<li><code><a title="meshtastic.deviceonly_pb2.DeviceState.OWNER_FIELD_NUMBER" href="#meshtastic.deviceonly_pb2.DeviceState.OWNER_FIELD_NUMBER">OWNER_FIELD_NUMBER</a></code></li>
|
|
<li><code><a title="meshtastic.deviceonly_pb2.DeviceState.RECEIVE_QUEUE_FIELD_NUMBER" href="#meshtastic.deviceonly_pb2.DeviceState.RECEIVE_QUEUE_FIELD_NUMBER">RECEIVE_QUEUE_FIELD_NUMBER</a></code></li>
|
|
<li><code><a title="meshtastic.deviceonly_pb2.DeviceState.RX_TEXT_MESSAGE_FIELD_NUMBER" href="#meshtastic.deviceonly_pb2.DeviceState.RX_TEXT_MESSAGE_FIELD_NUMBER">RX_TEXT_MESSAGE_FIELD_NUMBER</a></code></li>
|
|
<li><code><a title="meshtastic.deviceonly_pb2.DeviceState.RegisterExtension" href="#meshtastic.deviceonly_pb2.DeviceState.RegisterExtension">RegisterExtension</a></code></li>
|
|
<li><code><a title="meshtastic.deviceonly_pb2.DeviceState.SerializePartialToString" href="#meshtastic.deviceonly_pb2.DeviceState.SerializePartialToString">SerializePartialToString</a></code></li>
|
|
<li><code><a title="meshtastic.deviceonly_pb2.DeviceState.SerializeToString" href="#meshtastic.deviceonly_pb2.DeviceState.SerializeToString">SerializeToString</a></code></li>
|
|
<li><code><a title="meshtastic.deviceonly_pb2.DeviceState.SetInParent" href="#meshtastic.deviceonly_pb2.DeviceState.SetInParent">SetInParent</a></code></li>
|
|
<li><code><a title="meshtastic.deviceonly_pb2.DeviceState.UnknownFields" href="#meshtastic.deviceonly_pb2.DeviceState.UnknownFields">UnknownFields</a></code></li>
|
|
<li><code><a title="meshtastic.deviceonly_pb2.DeviceState.VERSION_FIELD_NUMBER" href="#meshtastic.deviceonly_pb2.DeviceState.VERSION_FIELD_NUMBER">VERSION_FIELD_NUMBER</a></code></li>
|
|
<li><code><a title="meshtastic.deviceonly_pb2.DeviceState.WhichOneof" href="#meshtastic.deviceonly_pb2.DeviceState.WhichOneof">WhichOneof</a></code></li>
|
|
<li><code><a title="meshtastic.deviceonly_pb2.DeviceState.did_gps_reset" href="#meshtastic.deviceonly_pb2.DeviceState.did_gps_reset">did_gps_reset</a></code></li>
|
|
<li><code><a title="meshtastic.deviceonly_pb2.DeviceState.legacyRadio" href="#meshtastic.deviceonly_pb2.DeviceState.legacyRadio">legacyRadio</a></code></li>
|
|
<li><code><a title="meshtastic.deviceonly_pb2.DeviceState.my_node" href="#meshtastic.deviceonly_pb2.DeviceState.my_node">my_node</a></code></li>
|
|
<li><code><a title="meshtastic.deviceonly_pb2.DeviceState.no_save" href="#meshtastic.deviceonly_pb2.DeviceState.no_save">no_save</a></code></li>
|
|
<li><code><a title="meshtastic.deviceonly_pb2.DeviceState.node_db" href="#meshtastic.deviceonly_pb2.DeviceState.node_db">node_db</a></code></li>
|
|
<li><code><a title="meshtastic.deviceonly_pb2.DeviceState.owner" href="#meshtastic.deviceonly_pb2.DeviceState.owner">owner</a></code></li>
|
|
<li><code><a title="meshtastic.deviceonly_pb2.DeviceState.receive_queue" href="#meshtastic.deviceonly_pb2.DeviceState.receive_queue">receive_queue</a></code></li>
|
|
<li><code><a title="meshtastic.deviceonly_pb2.DeviceState.rx_text_message" href="#meshtastic.deviceonly_pb2.DeviceState.rx_text_message">rx_text_message</a></code></li>
|
|
<li><code><a title="meshtastic.deviceonly_pb2.DeviceState.version" href="#meshtastic.deviceonly_pb2.DeviceState.version">version</a></code></li>
|
|
</ul>
|
|
</li>
|
|
<li>
|
|
<h4><code><a title="meshtastic.deviceonly_pb2.LegacyRadioConfig" href="#meshtastic.deviceonly_pb2.LegacyRadioConfig">LegacyRadioConfig</a></code></h4>
|
|
<ul class="">
|
|
<li><code><a title="meshtastic.deviceonly_pb2.LegacyRadioConfig.ByteSize" href="#meshtastic.deviceonly_pb2.LegacyRadioConfig.ByteSize">ByteSize</a></code></li>
|
|
<li><code><a title="meshtastic.deviceonly_pb2.LegacyRadioConfig.Clear" href="#meshtastic.deviceonly_pb2.LegacyRadioConfig.Clear">Clear</a></code></li>
|
|
<li><code><a title="meshtastic.deviceonly_pb2.LegacyRadioConfig.ClearField" href="#meshtastic.deviceonly_pb2.LegacyRadioConfig.ClearField">ClearField</a></code></li>
|
|
<li><code><a title="meshtastic.deviceonly_pb2.LegacyRadioConfig.DESCRIPTOR" href="#meshtastic.deviceonly_pb2.LegacyRadioConfig.DESCRIPTOR">DESCRIPTOR</a></code></li>
|
|
<li><code><a title="meshtastic.deviceonly_pb2.LegacyRadioConfig.DiscardUnknownFields" href="#meshtastic.deviceonly_pb2.LegacyRadioConfig.DiscardUnknownFields">DiscardUnknownFields</a></code></li>
|
|
<li><code><a title="meshtastic.deviceonly_pb2.LegacyRadioConfig.FindInitializationErrors" href="#meshtastic.deviceonly_pb2.LegacyRadioConfig.FindInitializationErrors">FindInitializationErrors</a></code></li>
|
|
<li><code><a title="meshtastic.deviceonly_pb2.LegacyRadioConfig.FromString" href="#meshtastic.deviceonly_pb2.LegacyRadioConfig.FromString">FromString</a></code></li>
|
|
<li><code><a title="meshtastic.deviceonly_pb2.LegacyRadioConfig.HasField" href="#meshtastic.deviceonly_pb2.LegacyRadioConfig.HasField">HasField</a></code></li>
|
|
<li><code><a title="meshtastic.deviceonly_pb2.LegacyRadioConfig.IsInitialized" href="#meshtastic.deviceonly_pb2.LegacyRadioConfig.IsInitialized">IsInitialized</a></code></li>
|
|
<li><code><a title="meshtastic.deviceonly_pb2.LegacyRadioConfig.LegacyPreferences" href="#meshtastic.deviceonly_pb2.LegacyRadioConfig.LegacyPreferences">LegacyPreferences</a></code></li>
|
|
<li><code><a title="meshtastic.deviceonly_pb2.LegacyRadioConfig.ListFields" href="#meshtastic.deviceonly_pb2.LegacyRadioConfig.ListFields">ListFields</a></code></li>
|
|
<li><code><a title="meshtastic.deviceonly_pb2.LegacyRadioConfig.MergeFrom" href="#meshtastic.deviceonly_pb2.LegacyRadioConfig.MergeFrom">MergeFrom</a></code></li>
|
|
<li><code><a title="meshtastic.deviceonly_pb2.LegacyRadioConfig.MergeFromString" href="#meshtastic.deviceonly_pb2.LegacyRadioConfig.MergeFromString">MergeFromString</a></code></li>
|
|
<li><code><a title="meshtastic.deviceonly_pb2.LegacyRadioConfig.PREFERENCES_FIELD_NUMBER" href="#meshtastic.deviceonly_pb2.LegacyRadioConfig.PREFERENCES_FIELD_NUMBER">PREFERENCES_FIELD_NUMBER</a></code></li>
|
|
<li><code><a title="meshtastic.deviceonly_pb2.LegacyRadioConfig.RegisterExtension" href="#meshtastic.deviceonly_pb2.LegacyRadioConfig.RegisterExtension">RegisterExtension</a></code></li>
|
|
<li><code><a title="meshtastic.deviceonly_pb2.LegacyRadioConfig.SerializePartialToString" href="#meshtastic.deviceonly_pb2.LegacyRadioConfig.SerializePartialToString">SerializePartialToString</a></code></li>
|
|
<li><code><a title="meshtastic.deviceonly_pb2.LegacyRadioConfig.SerializeToString" href="#meshtastic.deviceonly_pb2.LegacyRadioConfig.SerializeToString">SerializeToString</a></code></li>
|
|
<li><code><a title="meshtastic.deviceonly_pb2.LegacyRadioConfig.SetInParent" href="#meshtastic.deviceonly_pb2.LegacyRadioConfig.SetInParent">SetInParent</a></code></li>
|
|
<li><code><a title="meshtastic.deviceonly_pb2.LegacyRadioConfig.UnknownFields" href="#meshtastic.deviceonly_pb2.LegacyRadioConfig.UnknownFields">UnknownFields</a></code></li>
|
|
<li><code><a title="meshtastic.deviceonly_pb2.LegacyRadioConfig.WhichOneof" href="#meshtastic.deviceonly_pb2.LegacyRadioConfig.WhichOneof">WhichOneof</a></code></li>
|
|
<li><code><a title="meshtastic.deviceonly_pb2.LegacyRadioConfig.preferences" href="#meshtastic.deviceonly_pb2.LegacyRadioConfig.preferences">preferences</a></code></li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
</nav>
|
|
</main>
|
|
<footer id="footer">
|
|
<p>Generated by <a href="https://pdoc3.github.io/pdoc" title="pdoc: Python API documentation generator"><cite>pdoc</cite> 0.10.0</a>.</p>
|
|
</footer>
|
|
</body>
|
|
</html> |