Add python pycharm project

This commit is contained in:
Tobi
2019-04-28 11:16:27 +02:00
parent 113ec4e454
commit bacd6125d5
2096 changed files with 888984 additions and 0 deletions
@@ -0,0 +1,180 @@
Unless otherwise stated in that file, or the folder containing that file, all
files in the Cozmo SDK are Copyright (c) 2016-2017 Anki Inc. and licensed under
the Apache 2.0 License:
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
@@ -0,0 +1,74 @@
# Copyright (c) 2016 Anki, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License in the file LICENSE.txt or at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
__version__ = "3.4.0"
# build version string, to match the one in the app engine
__build_version__ = "00003.00004.00000"
class CLADHashMismatch(Exception):
'''Raised by assert_clad_match if the supplied CLAD hashes do not match'''
def assert_hash_match(first, second, check_name):
'''Compare two CLAD hashes for equality
Args:
first (int, list of ints or bytes): First hash to compare
second (int, list of ints or bytes): Second hash to compare
check_name (string): A description to put in a raised exception message
Returns:
True if the hashes match exactly
Raises:
CLADHashMismatch if the hashes do not match.
'''
def normalize(h):
if isinstance(h, bytes):
return h
if isinstance(h, list):
return bytes(h)
if isinstance(h, int):
return h.to_bytes(16, byteorder='little')
raise TypeError('Invalid hash type %s for value %s' % (type(h), h))
first = normalize(first)
second = normalize(second)
if first != second:
raise CLADHashMismatch("CLAD version mismatch (%s) %s != %s" % (check_name, first.hex(), second.hex()))
return True
def assert_clad_match(to_game_hash, to_engine_hash):
'''Assert that the supplied CLAD hashes match those in this package.
Args:
to_game_hash (int, list of ints or bytes): The expected hash for the
message engine to game interface
to_engine_hash (int, list of ints or bytes): The expected hash for the
message game to interface interface
Returns:
True if the hashes match exactly
Raises:
CLADHashMismatch if the hashes do not match.
'''
from .clad.externalInterface.messageEngineToGame_hash import messageEngineToGameHash as clad_to_game_hash
from .clad.externalInterface.messageGameToEngine_hash import messageGameToEngineHash as clad_to_engine_hash
assert_hash_match(to_game_hash, clad_to_game_hash, 'to_game')
assert_hash_match(to_engine_hash, clad_to_engine_hash, 'to_engine')
return True
@@ -0,0 +1,14 @@
# Copyright (c) 2016-2017 Anki, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License in the file LICENSE.txt or at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
@@ -0,0 +1,14 @@
# Copyright (c) 2016-2017 Anki, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License in the file LICENSE.txt or at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
@@ -0,0 +1,65 @@
# Copyright (c) 2016-2017 Anki, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License in the file LICENSE.txt or at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""
Autogenerated python message buffer code.
Source: clad/audio/audioBusTypes.clad
Full command line: ../tools/message-buffers/emitters/Python_emitter.py -C ./src/ -I ../robot/clad/src/ ../coretech/vision/clad/src/ ../coretech/common/clad/src/ ../lib/util/source/anki/clad -o ../generated/cladPython// clad/audio/audioBusTypes.clad
"""
from __future__ import absolute_import
from __future__ import print_function
def _modify_path():
import inspect, os, sys
search_paths = [
'../..',
'../../../../tools/message-buffers/support/python',
]
currentpath = os.path.abspath(os.path.dirname(inspect.getfile(inspect.currentframe())))
for search_path in search_paths:
search_path = os.path.normpath(os.path.abspath(os.path.realpath(os.path.join(currentpath, search_path))))
if search_path not in sys.path:
sys.path.insert(0, search_path)
_modify_path()
import msgbuffers
Anki = msgbuffers.Namespace()
Anki.AudioMetaData = msgbuffers.Namespace()
Anki.AudioMetaData.Bus = msgbuffers.Namespace()
class BusType(object):
"Automatically-generated uint_32 enumeration."
Cozmo_Robot = 1723505802
Cozmo_Robot_External = 2476517424
Invalid = 0
Master_Audio_Bus = 3803692087
Master_Secondary_Bus = 805203703
Music = 3991942870
Music_Codelab = 3829101743
Music_System = 792781730
Priority_Sfx = 2459405053
Robot_Bus_1 = 2678428988
Robot_Bus_2 = 2678428991
Robot_Bus_3 = 2678428990
Robot_Bus_4 = 2678428985
Sfx = 393239870
Ui = 1551306167
Vo = 1534528548
Anki.AudioMetaData.Bus.BusType = BusType
del BusType
@@ -0,0 +1,772 @@
# Copyright (c) 2016-2017 Anki, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License in the file LICENSE.txt or at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""
Autogenerated python message buffer code.
Source: clad/audio/audioCallbackMessage.clad
Full command line: ../tools/message-buffers/emitters/Python_emitter.py -C ./src/ -I ../robot/clad/src/ ../coretech/vision/clad/src/ ../coretech/common/clad/src/ ../lib/util/source/anki/clad -o ../generated/cladPython// clad/audio/audioCallbackMessage.clad
"""
from __future__ import absolute_import
from __future__ import print_function
def _modify_path():
import inspect, os, sys
search_paths = [
'../..',
'../../../../tools/message-buffers/support/python',
]
currentpath = os.path.abspath(os.path.dirname(inspect.getfile(inspect.currentframe())))
for search_path in search_paths:
search_path = os.path.normpath(os.path.abspath(os.path.realpath(os.path.join(currentpath, search_path))))
if search_path not in sys.path:
sys.path.insert(0, search_path)
_modify_path()
import msgbuffers
Anki = msgbuffers.Namespace()
Anki.AudioEngine = msgbuffers.Namespace()
Anki.AudioEngine.Multiplexer = msgbuffers.Namespace()
Anki.AudioMetaData = msgbuffers.Namespace()
Anki.AudioMetaData.GameEvent = msgbuffers.Namespace()
from clad.audio.audioEventTypes import Anki as _Anki
Anki.update(_Anki.deep_clone())
class AudioCallbackDuration(object):
"Generated message-passing structure."
__slots__ = (
'_duration', # float_32
'_estimatedDuration', # float_32
'_audioNodeId', # uint_32
'_isStreaming', # bool
)
@property
def duration(self):
"float_32 duration struct property."
return self._duration
@duration.setter
def duration(self, value):
self._duration = msgbuffers.validate_float(
'AudioCallbackDuration.duration', value, 'f')
@property
def estimatedDuration(self):
"float_32 estimatedDuration struct property."
return self._estimatedDuration
@estimatedDuration.setter
def estimatedDuration(self, value):
self._estimatedDuration = msgbuffers.validate_float(
'AudioCallbackDuration.estimatedDuration', value, 'f')
@property
def audioNodeId(self):
"uint_32 audioNodeId struct property."
return self._audioNodeId
@audioNodeId.setter
def audioNodeId(self, value):
self._audioNodeId = msgbuffers.validate_integer(
'AudioCallbackDuration.audioNodeId', value, 0, 4294967295)
@property
def isStreaming(self):
"bool isStreaming struct property."
return self._isStreaming
@isStreaming.setter
def isStreaming(self, value):
self._isStreaming = msgbuffers.validate_bool(
'AudioCallbackDuration.isStreaming', value)
def __init__(self, duration=0.0, estimatedDuration=0.0, audioNodeId=0, isStreaming=False):
self.duration = duration
self.estimatedDuration = estimatedDuration
self.audioNodeId = audioNodeId
self.isStreaming = isStreaming
@classmethod
def unpack(cls, buffer):
"Reads a new AudioCallbackDuration from the given buffer."
reader = msgbuffers.BinaryReader(buffer)
value = cls.unpack_from(reader)
if reader.tell() != len(reader):
raise msgbuffers.ReadError(
('AudioCallbackDuration.unpack received a buffer of length {length}, ' +
'but only {position} bytes were read.').format(
length=len(reader), position=reader.tell()))
return value
@classmethod
def unpack_from(cls, reader):
"Reads a new AudioCallbackDuration from the given BinaryReader."
_duration = reader.read('f')
_estimatedDuration = reader.read('f')
_audioNodeId = reader.read('I')
_isStreaming = bool(reader.read('b'))
return cls(_duration, _estimatedDuration, _audioNodeId, _isStreaming)
def pack(self):
"Writes the current AudioCallbackDuration, returning bytes."
writer = msgbuffers.BinaryWriter()
self.pack_to(writer)
return writer.dumps()
def pack_to(self, writer):
"Writes the current AudioCallbackDuration to the given BinaryWriter."
writer.write(self._duration, 'f')
writer.write(self._estimatedDuration, 'f')
writer.write(self._audioNodeId, 'I')
writer.write(int(self._isStreaming), 'b')
def __eq__(self, other):
if type(self) is type(other):
return (self._duration == other._duration and
self._estimatedDuration == other._estimatedDuration and
self._audioNodeId == other._audioNodeId and
self._isStreaming == other._isStreaming)
else:
return NotImplemented
def __ne__(self, other):
if type(self) is type(other):
return not self.__eq__(other)
else:
return NotImplemented
def __len__(self):
return (msgbuffers.size(self._duration, 'f') +
msgbuffers.size(self._estimatedDuration, 'f') +
msgbuffers.size(self._audioNodeId, 'I') +
msgbuffers.size(self._isStreaming, 'b'))
def __str__(self):
return '{type}(duration={duration}, estimatedDuration={estimatedDuration}, audioNodeId={audioNodeId}, isStreaming={isStreaming})'.format(
type=type(self).__name__,
duration=self._duration,
estimatedDuration=self._estimatedDuration,
audioNodeId=self._audioNodeId,
isStreaming=self._isStreaming)
def __repr__(self):
return '{type}(duration={duration}, estimatedDuration={estimatedDuration}, audioNodeId={audioNodeId}, isStreaming={isStreaming})'.format(
type=type(self).__name__,
duration=repr(self._duration),
estimatedDuration=repr(self._estimatedDuration),
audioNodeId=repr(self._audioNodeId),
isStreaming=repr(self._isStreaming))
Anki.AudioEngine.Multiplexer.AudioCallbackDuration = AudioCallbackDuration
del AudioCallbackDuration
class AudioCallbackMarker(object):
"Generated message-passing structure."
__slots__ = (
'_identifier', # uint_32
'_position', # uint_32
'_labelTitle', # string[uint_8]
)
@property
def identifier(self):
"uint_32 identifier struct property."
return self._identifier
@identifier.setter
def identifier(self, value):
self._identifier = msgbuffers.validate_integer(
'AudioCallbackMarker.identifier', value, 0, 4294967295)
@property
def position(self):
"uint_32 position struct property."
return self._position
@position.setter
def position(self, value):
self._position = msgbuffers.validate_integer(
'AudioCallbackMarker.position', value, 0, 4294967295)
@property
def labelTitle(self):
"string[uint_8] labelTitle struct property."
return self._labelTitle
@labelTitle.setter
def labelTitle(self, value):
self._labelTitle = msgbuffers.validate_string(
'AudioCallbackMarker.labelTitle', value, 255)
def __init__(self, identifier=0, position=0, labelTitle=''):
self.identifier = identifier
self.position = position
self.labelTitle = labelTitle
@classmethod
def unpack(cls, buffer):
"Reads a new AudioCallbackMarker from the given buffer."
reader = msgbuffers.BinaryReader(buffer)
value = cls.unpack_from(reader)
if reader.tell() != len(reader):
raise msgbuffers.ReadError(
('AudioCallbackMarker.unpack received a buffer of length {length}, ' +
'but only {position} bytes were read.').format(
length=len(reader), position=reader.tell()))
return value
@classmethod
def unpack_from(cls, reader):
"Reads a new AudioCallbackMarker from the given BinaryReader."
_identifier = reader.read('I')
_position = reader.read('I')
_labelTitle = reader.read_string('B')
return cls(_identifier, _position, _labelTitle)
def pack(self):
"Writes the current AudioCallbackMarker, returning bytes."
writer = msgbuffers.BinaryWriter()
self.pack_to(writer)
return writer.dumps()
def pack_to(self, writer):
"Writes the current AudioCallbackMarker to the given BinaryWriter."
writer.write(self._identifier, 'I')
writer.write(self._position, 'I')
writer.write_string(self._labelTitle, 'B')
def __eq__(self, other):
if type(self) is type(other):
return (self._identifier == other._identifier and
self._position == other._position and
self._labelTitle == other._labelTitle)
else:
return NotImplemented
def __ne__(self, other):
if type(self) is type(other):
return not self.__eq__(other)
else:
return NotImplemented
def __len__(self):
return (msgbuffers.size(self._identifier, 'I') +
msgbuffers.size(self._position, 'I') +
msgbuffers.size_string(self._labelTitle, 'B'))
def __str__(self):
return '{type}(identifier={identifier}, position={position}, labelTitle={labelTitle})'.format(
type=type(self).__name__,
identifier=self._identifier,
position=self._position,
labelTitle=msgbuffers.shorten_string(self._labelTitle))
def __repr__(self):
return '{type}(identifier={identifier}, position={position}, labelTitle={labelTitle})'.format(
type=type(self).__name__,
identifier=repr(self._identifier),
position=repr(self._position),
labelTitle=repr(self._labelTitle))
Anki.AudioEngine.Multiplexer.AudioCallbackMarker = AudioCallbackMarker
del AudioCallbackMarker
class AudioCallbackComplete(object):
"Generated message-passing structure."
__slots__ = (
'_eventType', # Anki.AudioMetaData.GameEvent.GenericEvent
)
@property
def eventType(self):
"Anki.AudioMetaData.GameEvent.GenericEvent eventType struct property."
return self._eventType
@eventType.setter
def eventType(self, value):
self._eventType = msgbuffers.validate_integer(
'AudioCallbackComplete.eventType', value, 0, 4294967295)
def __init__(self, eventType=Anki.AudioMetaData.GameEvent.GenericEvent.Invalid):
self.eventType = eventType
@classmethod
def unpack(cls, buffer):
"Reads a new AudioCallbackComplete from the given buffer."
reader = msgbuffers.BinaryReader(buffer)
value = cls.unpack_from(reader)
if reader.tell() != len(reader):
raise msgbuffers.ReadError(
('AudioCallbackComplete.unpack received a buffer of length {length}, ' +
'but only {position} bytes were read.').format(
length=len(reader), position=reader.tell()))
return value
@classmethod
def unpack_from(cls, reader):
"Reads a new AudioCallbackComplete from the given BinaryReader."
_eventType = reader.read('I')
return cls(_eventType)
def pack(self):
"Writes the current AudioCallbackComplete, returning bytes."
writer = msgbuffers.BinaryWriter()
self.pack_to(writer)
return writer.dumps()
def pack_to(self, writer):
"Writes the current AudioCallbackComplete to the given BinaryWriter."
writer.write(self._eventType, 'I')
def __eq__(self, other):
if type(self) is type(other):
return self._eventType == other._eventType
else:
return NotImplemented
def __ne__(self, other):
if type(self) is type(other):
return not self.__eq__(other)
else:
return NotImplemented
def __len__(self):
return (msgbuffers.size(self._eventType, 'I'))
def __str__(self):
return '{type}(eventType={eventType})'.format(
type=type(self).__name__,
eventType=self._eventType)
def __repr__(self):
return '{type}(eventType={eventType})'.format(
type=type(self).__name__,
eventType=repr(self._eventType))
Anki.AudioEngine.Multiplexer.AudioCallbackComplete = AudioCallbackComplete
del AudioCallbackComplete
class CallbackErrorType(object):
"Automatically-generated uint_8 enumeration."
Invalid = 0
EventFailed = 1
Starvation = 2
Anki.AudioEngine.Multiplexer.CallbackErrorType = CallbackErrorType
del CallbackErrorType
class AudioCallbackError(object):
"Generated message-passing structure."
__slots__ = (
'_callbackError', # Anki.AudioEngine.Multiplexer.CallbackErrorType
)
@property
def callbackError(self):
"Anki.AudioEngine.Multiplexer.CallbackErrorType callbackError struct property."
return self._callbackError
@callbackError.setter
def callbackError(self, value):
self._callbackError = msgbuffers.validate_integer(
'AudioCallbackError.callbackError', value, 0, 255)
def __init__(self, callbackError=Anki.AudioEngine.Multiplexer.CallbackErrorType.Invalid):
self.callbackError = callbackError
@classmethod
def unpack(cls, buffer):
"Reads a new AudioCallbackError from the given buffer."
reader = msgbuffers.BinaryReader(buffer)
value = cls.unpack_from(reader)
if reader.tell() != len(reader):
raise msgbuffers.ReadError(
('AudioCallbackError.unpack received a buffer of length {length}, ' +
'but only {position} bytes were read.').format(
length=len(reader), position=reader.tell()))
return value
@classmethod
def unpack_from(cls, reader):
"Reads a new AudioCallbackError from the given BinaryReader."
_callbackError = reader.read('B')
return cls(_callbackError)
def pack(self):
"Writes the current AudioCallbackError, returning bytes."
writer = msgbuffers.BinaryWriter()
self.pack_to(writer)
return writer.dumps()
def pack_to(self, writer):
"Writes the current AudioCallbackError to the given BinaryWriter."
writer.write(self._callbackError, 'B')
def __eq__(self, other):
if type(self) is type(other):
return self._callbackError == other._callbackError
else:
return NotImplemented
def __ne__(self, other):
if type(self) is type(other):
return not self.__eq__(other)
else:
return NotImplemented
def __len__(self):
return (msgbuffers.size(self._callbackError, 'B'))
def __str__(self):
return '{type}(callbackError={callbackError})'.format(
type=type(self).__name__,
callbackError=self._callbackError)
def __repr__(self):
return '{type}(callbackError={callbackError})'.format(
type=type(self).__name__,
callbackError=repr(self._callbackError))
Anki.AudioEngine.Multiplexer.AudioCallbackError = AudioCallbackError
del AudioCallbackError
class AudioCallbackInfo(object):
"Generated message-passing union."
__slots__ = ('_tag', '_data')
class Tag(object):
"The type indicator for this union."
callbackDuration = 0 # Anki.AudioEngine.Multiplexer.AudioCallbackDuration
callbackMarker = 1 # Anki.AudioEngine.Multiplexer.AudioCallbackMarker
callbackComplete = 2 # Anki.AudioEngine.Multiplexer.AudioCallbackComplete
callbackError = 3 # Anki.AudioEngine.Multiplexer.AudioCallbackError
@property
def tag(self):
"The current tag for this union."
return self._tag
@property
def tag_name(self):
"The name of the current tag for this union."
if self._tag in self._tags_by_value:
return self._tags_by_value[self._tag]
else:
return None
@property
def data(self):
"The data held by this union. None if no data is set."
return self._data
@property
def callbackDuration(self):
"Anki.AudioEngine.Multiplexer.AudioCallbackDuration callbackDuration union property."
msgbuffers.safety_check_tag('callbackDuration', self._tag, self.Tag.callbackDuration, self._tags_by_value)
return self._data
@callbackDuration.setter
def callbackDuration(self, value):
self._data = msgbuffers.validate_object(
'AudioCallbackInfo.callbackDuration', value, Anki.AudioEngine.Multiplexer.AudioCallbackDuration)
self._tag = self.Tag.callbackDuration
@property
def callbackMarker(self):
"Anki.AudioEngine.Multiplexer.AudioCallbackMarker callbackMarker union property."
msgbuffers.safety_check_tag('callbackMarker', self._tag, self.Tag.callbackMarker, self._tags_by_value)
return self._data
@callbackMarker.setter
def callbackMarker(self, value):
self._data = msgbuffers.validate_object(
'AudioCallbackInfo.callbackMarker', value, Anki.AudioEngine.Multiplexer.AudioCallbackMarker)
self._tag = self.Tag.callbackMarker
@property
def callbackComplete(self):
"Anki.AudioEngine.Multiplexer.AudioCallbackComplete callbackComplete union property."
msgbuffers.safety_check_tag('callbackComplete', self._tag, self.Tag.callbackComplete, self._tags_by_value)
return self._data
@callbackComplete.setter
def callbackComplete(self, value):
self._data = msgbuffers.validate_object(
'AudioCallbackInfo.callbackComplete', value, Anki.AudioEngine.Multiplexer.AudioCallbackComplete)
self._tag = self.Tag.callbackComplete
@property
def callbackError(self):
"Anki.AudioEngine.Multiplexer.AudioCallbackError callbackError union property."
msgbuffers.safety_check_tag('callbackError', self._tag, self.Tag.callbackError, self._tags_by_value)
return self._data
@callbackError.setter
def callbackError(self, value):
self._data = msgbuffers.validate_object(
'AudioCallbackInfo.callbackError', value, Anki.AudioEngine.Multiplexer.AudioCallbackError)
self._tag = self.Tag.callbackError
def __init__(self, **kwargs):
if not kwargs:
self._tag = None
self._data = None
elif len(kwargs) == 1:
key, value = next(iter(kwargs.items()))
if key not in self._tags_by_name:
raise TypeError("'{argument}' is an invalid keyword argument for this method.".format(argument=key))
# calls the correct property
setattr(self, key, value)
else:
raise TypeError('This method only accepts up to one keyword argument.')
@classmethod
def unpack(cls, buffer):
"Reads a new AudioCallbackInfo from the given buffer."
reader = msgbuffers.BinaryReader(buffer)
value = cls.unpack_from(reader)
if reader.tell() != len(reader):
raise msgbuffers.ReadError(
('AudioCallbackInfo.unpack received a buffer of length {length}, ' +
'but only {position} bytes were read.').format(
length=len(reader), position=reader.tell()))
return value
@classmethod
def unpack_from(cls, reader):
"Reads a new AudioCallbackInfo from the given BinaryReader."
tag = reader.read('B')
if tag in cls._tags_by_value:
value = cls()
setattr(value, cls._tags_by_value[tag], cls._tag_unpack_methods[tag](reader))
return value
else:
raise ValueError('AudioCallbackInfo attempted to unpack unknown tag {tag}.'.format(tag=tag))
def pack(self):
"Writes the current AudioCallbackInfo, returning bytes."
writer = msgbuffers.BinaryWriter()
self.pack_to(writer)
return writer.dumps()
def pack_to(self, writer):
"Writes the current SampleUnion to the given BinaryWriter."
if self._tag in self._tags_by_value:
writer.write(self._tag, 'B')
self._tag_pack_methods[self._tag](writer, self._data)
else:
raise ValueError('Cannot pack an empty AudioCallbackInfo.')
def clear(self):
self._tag = None
self._data = None
@classmethod
def typeByTag(cls, tag):
return cls._type_by_tag_value[tag]()
def __eq__(self, other):
if type(self) is type(other):
return self._tag == other._tag and self._data == other._data
else:
return NotImplemented
def __ne__(self, other):
if type(self) is type(other):
return not self.__eq__(other)
else:
return NotImplemented
def __len__(self):
if 0 <= self._tag < 4:
return self._tag_size_methods[self._tag](self._data)
else:
return 1
def __str__(self):
if 0 <= self._tag < 4:
return '{type}({name}={value})'.format(
type=type(self).__name__,
name=self.tag_name,
value=self._data)
else:
return '{type}()'.format(
type=type(self).__name__)
def __repr__(self):
if 0 <= self._tag < 4:
return '{type}({name}={value})'.format(
type=type(self).__name__,
name=self.tag_name,
value=repr(self._data))
else:
return '{type}()'.format(
type=type(self).__name__)
_tags_by_name = dict(
callbackDuration=0,
callbackMarker=1,
callbackComplete=2,
callbackError=3,
)
_tags_by_value = dict()
_tags_by_value[0] = 'callbackDuration'
_tags_by_value[1] = 'callbackMarker'
_tags_by_value[2] = 'callbackComplete'
_tags_by_value[3] = 'callbackError'
_tag_unpack_methods = dict()
_tag_unpack_methods[0] = lambda reader: reader.read_object(Anki.AudioEngine.Multiplexer.AudioCallbackDuration.unpack_from)
_tag_unpack_methods[1] = lambda reader: reader.read_object(Anki.AudioEngine.Multiplexer.AudioCallbackMarker.unpack_from)
_tag_unpack_methods[2] = lambda reader: reader.read_object(Anki.AudioEngine.Multiplexer.AudioCallbackComplete.unpack_from)
_tag_unpack_methods[3] = lambda reader: reader.read_object(Anki.AudioEngine.Multiplexer.AudioCallbackError.unpack_from)
_tag_pack_methods = dict()
_tag_pack_methods[0] = lambda writer, value: writer.write_object(value)
_tag_pack_methods[1] = lambda writer, value: writer.write_object(value)
_tag_pack_methods[2] = lambda writer, value: writer.write_object(value)
_tag_pack_methods[3] = lambda writer, value: writer.write_object(value)
_tag_size_methods = dict()
_tag_size_methods[0] = lambda value: msgbuffers.size_object(value)
_tag_size_methods[1] = lambda value: msgbuffers.size_object(value)
_tag_size_methods[2] = lambda value: msgbuffers.size_object(value)
_tag_size_methods[3] = lambda value: msgbuffers.size_object(value)
_type_by_tag_value = dict()
_type_by_tag_value[0] = lambda : Anki.AudioEngine.Multiplexer.AudioCallbackDuration
_type_by_tag_value[1] = lambda : Anki.AudioEngine.Multiplexer.AudioCallbackMarker
_type_by_tag_value[2] = lambda : Anki.AudioEngine.Multiplexer.AudioCallbackComplete
_type_by_tag_value[3] = lambda : Anki.AudioEngine.Multiplexer.AudioCallbackError
Anki.AudioEngine.Multiplexer.AudioCallbackInfo = AudioCallbackInfo
del AudioCallbackInfo
class AudioCallback(object):
"Generated message-passing message."
__slots__ = (
'_callbackId', # uint_16
'_callbackInfo', # Anki.AudioEngine.Multiplexer.AudioCallbackInfo
)
@property
def callbackId(self):
"uint_16 callbackId struct property."
return self._callbackId
@callbackId.setter
def callbackId(self, value):
self._callbackId = msgbuffers.validate_integer(
'AudioCallback.callbackId', value, 0, 65535)
@property
def callbackInfo(self):
"Anki.AudioEngine.Multiplexer.AudioCallbackInfo callbackInfo struct property."
return self._callbackInfo
@callbackInfo.setter
def callbackInfo(self, value):
self._callbackInfo = msgbuffers.validate_object(
'AudioCallback.callbackInfo', value, Anki.AudioEngine.Multiplexer.AudioCallbackInfo)
def __init__(self, callbackId=0, callbackInfo=Anki.AudioEngine.Multiplexer.AudioCallbackInfo()):
self.callbackId = callbackId
self.callbackInfo = callbackInfo
@classmethod
def unpack(cls, buffer):
"Reads a new AudioCallback from the given buffer."
reader = msgbuffers.BinaryReader(buffer)
value = cls.unpack_from(reader)
if reader.tell() != len(reader):
raise msgbuffers.ReadError(
('AudioCallback.unpack received a buffer of length {length}, ' +
'but only {position} bytes were read.').format(
length=len(reader), position=reader.tell()))
return value
@classmethod
def unpack_from(cls, reader):
"Reads a new AudioCallback from the given BinaryReader."
_callbackId = reader.read('H')
_callbackInfo = reader.read_object(Anki.AudioEngine.Multiplexer.AudioCallbackInfo.unpack_from)
return cls(_callbackId, _callbackInfo)
def pack(self):
"Writes the current AudioCallback, returning bytes."
writer = msgbuffers.BinaryWriter()
self.pack_to(writer)
return writer.dumps()
def pack_to(self, writer):
"Writes the current AudioCallback to the given BinaryWriter."
writer.write(self._callbackId, 'H')
writer.write_object(self._callbackInfo)
def __eq__(self, other):
if type(self) is type(other):
return (self._callbackId == other._callbackId and
self._callbackInfo == other._callbackInfo)
else:
return NotImplemented
def __ne__(self, other):
if type(self) is type(other):
return not self.__eq__(other)
else:
return NotImplemented
def __len__(self):
return (msgbuffers.size(self._callbackId, 'H') +
msgbuffers.size_object(self._callbackInfo))
def __str__(self):
return '{type}(callbackId={callbackId}, callbackInfo={callbackInfo})'.format(
type=type(self).__name__,
callbackId=self._callbackId,
callbackInfo=self._callbackInfo)
def __repr__(self):
return '{type}(callbackId={callbackId}, callbackInfo={callbackInfo})'.format(
type=type(self).__name__,
callbackId=repr(self._callbackId),
callbackInfo=repr(self._callbackInfo))
Anki.AudioEngine.Multiplexer.AudioCallback = AudioCallback
del AudioCallback
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,60 @@
# Copyright (c) 2016-2017 Anki, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License in the file LICENSE.txt or at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""
Autogenerated python message buffer code.
Source: clad/audio/audioGameObjectTypes.clad
Full command line: ../tools/message-buffers/emitters/Python_emitter.py -C ./src/ -I ../robot/clad/src/ ../coretech/vision/clad/src/ ../coretech/common/clad/src/ ../lib/util/source/anki/clad -o ../generated/cladPython// clad/audio/audioGameObjectTypes.clad
"""
from __future__ import absolute_import
from __future__ import print_function
def _modify_path():
import inspect, os, sys
search_paths = [
'../..',
'../../../../tools/message-buffers/support/python',
]
currentpath = os.path.abspath(os.path.dirname(inspect.getfile(inspect.currentframe())))
for search_path in search_paths:
search_path = os.path.normpath(os.path.abspath(os.path.realpath(os.path.join(currentpath, search_path))))
if search_path not in sys.path:
sys.path.insert(0, search_path)
_modify_path()
import msgbuffers
Anki = msgbuffers.Namespace()
Anki.AudioMetaData = msgbuffers.Namespace()
class GameObjectType(object):
"Automatically-generated uint_32 enumeration."
Invalid = 0
Default = 1
UI = 2
SFX = 3
CodeLab = 4
Aria = 5
Cozmo_OnDevice = 6
CozmoBus_1 = 7
CozmoBus_2 = 8
CozmoBus_3 = 9
CozmoBus_4 = 10
End = 11
Anki.AudioMetaData.GameObjectType = GameObjectType
del GameObjectType
@@ -0,0 +1,725 @@
# Copyright (c) 2016-2017 Anki, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License in the file LICENSE.txt or at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""
Autogenerated python message buffer code.
Source: clad/audio/audioMessage.clad
Full command line: ../tools/message-buffers/emitters/Python_emitter.py -C ./src/ -I ../robot/clad/src/ ../coretech/vision/clad/src/ ../coretech/common/clad/src/ ../lib/util/source/anki/clad -o ../generated/cladPython// clad/audio/audioMessage.clad
"""
from __future__ import absolute_import
from __future__ import print_function
def _modify_path():
import inspect, os, sys
search_paths = [
'../..',
'../../../../tools/message-buffers/support/python',
]
currentpath = os.path.abspath(os.path.dirname(inspect.getfile(inspect.currentframe())))
for search_path in search_paths:
search_path = os.path.normpath(os.path.abspath(os.path.realpath(os.path.join(currentpath, search_path))))
if search_path not in sys.path:
sys.path.insert(0, search_path)
_modify_path()
import msgbuffers
Anki = msgbuffers.Namespace()
Anki.AudioEngine = msgbuffers.Namespace()
Anki.AudioEngine.Multiplexer = msgbuffers.Namespace()
Anki.AudioMetaData = msgbuffers.Namespace()
Anki.AudioMetaData.GameEvent = msgbuffers.Namespace()
Anki.AudioMetaData.GameParameter = msgbuffers.Namespace()
Anki.AudioMetaData.GameState = msgbuffers.Namespace()
Anki.AudioMetaData.SwitchState = msgbuffers.Namespace()
from clad.audio.audioEventTypes import Anki as _Anki
Anki.update(_Anki.deep_clone())
from clad.audio.audioGameObjectTypes import Anki as _Anki
Anki.update(_Anki.deep_clone())
from clad.audio.audioMessageTypes import Anki as _Anki
Anki.update(_Anki.deep_clone())
from clad.audio.audioParameterTypes import Anki as _Anki
Anki.update(_Anki.deep_clone())
from clad.audio.audioStateTypes import Anki as _Anki
Anki.update(_Anki.deep_clone())
from clad.audio.audioSwitchTypes import Anki as _Anki
Anki.update(_Anki.deep_clone())
class PostAudioEvent(object):
"Generated message-passing message."
__slots__ = (
'_audioEvent', # Anki.AudioMetaData.GameEvent.GenericEvent
'_gameObject', # Anki.AudioMetaData.GameObjectType
'_callbackId', # uint_16
)
@property
def audioEvent(self):
"Anki.AudioMetaData.GameEvent.GenericEvent audioEvent struct property."
return self._audioEvent
@audioEvent.setter
def audioEvent(self, value):
self._audioEvent = msgbuffers.validate_integer(
'PostAudioEvent.audioEvent', value, 0, 4294967295)
@property
def gameObject(self):
"Anki.AudioMetaData.GameObjectType gameObject struct property."
return self._gameObject
@gameObject.setter
def gameObject(self, value):
self._gameObject = msgbuffers.validate_integer(
'PostAudioEvent.gameObject', value, 0, 4294967295)
@property
def callbackId(self):
"uint_16 callbackId struct property."
return self._callbackId
@callbackId.setter
def callbackId(self, value):
self._callbackId = msgbuffers.validate_integer(
'PostAudioEvent.callbackId', value, 0, 65535)
def __init__(self, audioEvent=Anki.AudioMetaData.GameEvent.GenericEvent.Invalid, gameObject=Anki.AudioMetaData.GameObjectType.Invalid, callbackId=0):
self.audioEvent = audioEvent
self.gameObject = gameObject
self.callbackId = callbackId
@classmethod
def unpack(cls, buffer):
"Reads a new PostAudioEvent from the given buffer."
reader = msgbuffers.BinaryReader(buffer)
value = cls.unpack_from(reader)
if reader.tell() != len(reader):
raise msgbuffers.ReadError(
('PostAudioEvent.unpack received a buffer of length {length}, ' +
'but only {position} bytes were read.').format(
length=len(reader), position=reader.tell()))
return value
@classmethod
def unpack_from(cls, reader):
"Reads a new PostAudioEvent from the given BinaryReader."
_audioEvent = reader.read('I')
_gameObject = reader.read('I')
_callbackId = reader.read('H')
return cls(_audioEvent, _gameObject, _callbackId)
def pack(self):
"Writes the current PostAudioEvent, returning bytes."
writer = msgbuffers.BinaryWriter()
self.pack_to(writer)
return writer.dumps()
def pack_to(self, writer):
"Writes the current PostAudioEvent to the given BinaryWriter."
writer.write(self._audioEvent, 'I')
writer.write(self._gameObject, 'I')
writer.write(self._callbackId, 'H')
def __eq__(self, other):
if type(self) is type(other):
return (self._audioEvent == other._audioEvent and
self._gameObject == other._gameObject and
self._callbackId == other._callbackId)
else:
return NotImplemented
def __ne__(self, other):
if type(self) is type(other):
return not self.__eq__(other)
else:
return NotImplemented
def __len__(self):
return (msgbuffers.size(self._audioEvent, 'I') +
msgbuffers.size(self._gameObject, 'I') +
msgbuffers.size(self._callbackId, 'H'))
def __str__(self):
return '{type}(audioEvent={audioEvent}, gameObject={gameObject}, callbackId={callbackId})'.format(
type=type(self).__name__,
audioEvent=self._audioEvent,
gameObject=self._gameObject,
callbackId=self._callbackId)
def __repr__(self):
return '{type}(audioEvent={audioEvent}, gameObject={gameObject}, callbackId={callbackId})'.format(
type=type(self).__name__,
audioEvent=repr(self._audioEvent),
gameObject=repr(self._gameObject),
callbackId=repr(self._callbackId))
Anki.AudioEngine.Multiplexer.PostAudioEvent = PostAudioEvent
del PostAudioEvent
class StopAllAudioEvents(object):
"Generated message-passing message."
__slots__ = (
'_gameObject', # Anki.AudioMetaData.GameObjectType
)
@property
def gameObject(self):
"Anki.AudioMetaData.GameObjectType gameObject struct property."
return self._gameObject
@gameObject.setter
def gameObject(self, value):
self._gameObject = msgbuffers.validate_integer(
'StopAllAudioEvents.gameObject', value, 0, 4294967295)
def __init__(self, gameObject=Anki.AudioMetaData.GameObjectType.Invalid):
self.gameObject = gameObject
@classmethod
def unpack(cls, buffer):
"Reads a new StopAllAudioEvents from the given buffer."
reader = msgbuffers.BinaryReader(buffer)
value = cls.unpack_from(reader)
if reader.tell() != len(reader):
raise msgbuffers.ReadError(
('StopAllAudioEvents.unpack received a buffer of length {length}, ' +
'but only {position} bytes were read.').format(
length=len(reader), position=reader.tell()))
return value
@classmethod
def unpack_from(cls, reader):
"Reads a new StopAllAudioEvents from the given BinaryReader."
_gameObject = reader.read('I')
return cls(_gameObject)
def pack(self):
"Writes the current StopAllAudioEvents, returning bytes."
writer = msgbuffers.BinaryWriter()
self.pack_to(writer)
return writer.dumps()
def pack_to(self, writer):
"Writes the current StopAllAudioEvents to the given BinaryWriter."
writer.write(self._gameObject, 'I')
def __eq__(self, other):
if type(self) is type(other):
return self._gameObject == other._gameObject
else:
return NotImplemented
def __ne__(self, other):
if type(self) is type(other):
return not self.__eq__(other)
else:
return NotImplemented
def __len__(self):
return (msgbuffers.size(self._gameObject, 'I'))
def __str__(self):
return '{type}(gameObject={gameObject})'.format(
type=type(self).__name__,
gameObject=self._gameObject)
def __repr__(self):
return '{type}(gameObject={gameObject})'.format(
type=type(self).__name__,
gameObject=repr(self._gameObject))
Anki.AudioEngine.Multiplexer.StopAllAudioEvents = StopAllAudioEvents
del StopAllAudioEvents
class PostAudioGameState(object):
"Generated message-passing message."
__slots__ = (
'_stateGroup', # Anki.AudioMetaData.GameState.StateGroupType
'_stateValue', # Anki.AudioMetaData.GameState.GenericState
)
@property
def stateGroup(self):
"Anki.AudioMetaData.GameState.StateGroupType stateGroup struct property."
return self._stateGroup
@stateGroup.setter
def stateGroup(self, value):
self._stateGroup = msgbuffers.validate_integer(
'PostAudioGameState.stateGroup', value, 0, 4294967295)
@property
def stateValue(self):
"Anki.AudioMetaData.GameState.GenericState stateValue struct property."
return self._stateValue
@stateValue.setter
def stateValue(self, value):
self._stateValue = msgbuffers.validate_integer(
'PostAudioGameState.stateValue', value, 0, 4294967295)
def __init__(self, stateGroup=Anki.AudioMetaData.GameState.StateGroupType.External_Language, stateValue=Anki.AudioMetaData.GameState.GenericState.Invalid):
self.stateGroup = stateGroup
self.stateValue = stateValue
@classmethod
def unpack(cls, buffer):
"Reads a new PostAudioGameState from the given buffer."
reader = msgbuffers.BinaryReader(buffer)
value = cls.unpack_from(reader)
if reader.tell() != len(reader):
raise msgbuffers.ReadError(
('PostAudioGameState.unpack received a buffer of length {length}, ' +
'but only {position} bytes were read.').format(
length=len(reader), position=reader.tell()))
return value
@classmethod
def unpack_from(cls, reader):
"Reads a new PostAudioGameState from the given BinaryReader."
_stateGroup = reader.read('I')
_stateValue = reader.read('I')
return cls(_stateGroup, _stateValue)
def pack(self):
"Writes the current PostAudioGameState, returning bytes."
writer = msgbuffers.BinaryWriter()
self.pack_to(writer)
return writer.dumps()
def pack_to(self, writer):
"Writes the current PostAudioGameState to the given BinaryWriter."
writer.write(self._stateGroup, 'I')
writer.write(self._stateValue, 'I')
def __eq__(self, other):
if type(self) is type(other):
return (self._stateGroup == other._stateGroup and
self._stateValue == other._stateValue)
else:
return NotImplemented
def __ne__(self, other):
if type(self) is type(other):
return not self.__eq__(other)
else:
return NotImplemented
def __len__(self):
return (msgbuffers.size(self._stateGroup, 'I') +
msgbuffers.size(self._stateValue, 'I'))
def __str__(self):
return '{type}(stateGroup={stateGroup}, stateValue={stateValue})'.format(
type=type(self).__name__,
stateGroup=self._stateGroup,
stateValue=self._stateValue)
def __repr__(self):
return '{type}(stateGroup={stateGroup}, stateValue={stateValue})'.format(
type=type(self).__name__,
stateGroup=repr(self._stateGroup),
stateValue=repr(self._stateValue))
Anki.AudioEngine.Multiplexer.PostAudioGameState = PostAudioGameState
del PostAudioGameState
class PostAudioSwitchState(object):
"Generated message-passing message."
__slots__ = (
'_switchStateGroup', # Anki.AudioMetaData.SwitchState.SwitchGroupType
'_switchStateValue', # Anki.AudioMetaData.SwitchState.GenericSwitch
'_gameObject', # Anki.AudioMetaData.GameObjectType
)
@property
def switchStateGroup(self):
"Anki.AudioMetaData.SwitchState.SwitchGroupType switchStateGroup struct property."
return self._switchStateGroup
@switchStateGroup.setter
def switchStateGroup(self, value):
self._switchStateGroup = msgbuffers.validate_integer(
'PostAudioSwitchState.switchStateGroup', value, 0, 4294967295)
@property
def switchStateValue(self):
"Anki.AudioMetaData.SwitchState.GenericSwitch switchStateValue struct property."
return self._switchStateValue
@switchStateValue.setter
def switchStateValue(self, value):
self._switchStateValue = msgbuffers.validate_integer(
'PostAudioSwitchState.switchStateValue', value, 0, 4294967295)
@property
def gameObject(self):
"Anki.AudioMetaData.GameObjectType gameObject struct property."
return self._gameObject
@gameObject.setter
def gameObject(self, value):
self._gameObject = msgbuffers.validate_integer(
'PostAudioSwitchState.gameObject', value, 0, 4294967295)
def __init__(self, switchStateGroup=Anki.AudioMetaData.SwitchState.SwitchGroupType.Codelab__Music_Tiny_Orchestra, switchStateValue=Anki.AudioMetaData.SwitchState.GenericSwitch.Invalid, gameObject=Anki.AudioMetaData.GameObjectType.Invalid):
self.switchStateGroup = switchStateGroup
self.switchStateValue = switchStateValue
self.gameObject = gameObject
@classmethod
def unpack(cls, buffer):
"Reads a new PostAudioSwitchState from the given buffer."
reader = msgbuffers.BinaryReader(buffer)
value = cls.unpack_from(reader)
if reader.tell() != len(reader):
raise msgbuffers.ReadError(
('PostAudioSwitchState.unpack received a buffer of length {length}, ' +
'but only {position} bytes were read.').format(
length=len(reader), position=reader.tell()))
return value
@classmethod
def unpack_from(cls, reader):
"Reads a new PostAudioSwitchState from the given BinaryReader."
_switchStateGroup = reader.read('I')
_switchStateValue = reader.read('I')
_gameObject = reader.read('I')
return cls(_switchStateGroup, _switchStateValue, _gameObject)
def pack(self):
"Writes the current PostAudioSwitchState, returning bytes."
writer = msgbuffers.BinaryWriter()
self.pack_to(writer)
return writer.dumps()
def pack_to(self, writer):
"Writes the current PostAudioSwitchState to the given BinaryWriter."
writer.write(self._switchStateGroup, 'I')
writer.write(self._switchStateValue, 'I')
writer.write(self._gameObject, 'I')
def __eq__(self, other):
if type(self) is type(other):
return (self._switchStateGroup == other._switchStateGroup and
self._switchStateValue == other._switchStateValue and
self._gameObject == other._gameObject)
else:
return NotImplemented
def __ne__(self, other):
if type(self) is type(other):
return not self.__eq__(other)
else:
return NotImplemented
def __len__(self):
return (msgbuffers.size(self._switchStateGroup, 'I') +
msgbuffers.size(self._switchStateValue, 'I') +
msgbuffers.size(self._gameObject, 'I'))
def __str__(self):
return '{type}(switchStateGroup={switchStateGroup}, switchStateValue={switchStateValue}, gameObject={gameObject})'.format(
type=type(self).__name__,
switchStateGroup=self._switchStateGroup,
switchStateValue=self._switchStateValue,
gameObject=self._gameObject)
def __repr__(self):
return '{type}(switchStateGroup={switchStateGroup}, switchStateValue={switchStateValue}, gameObject={gameObject})'.format(
type=type(self).__name__,
switchStateGroup=repr(self._switchStateGroup),
switchStateValue=repr(self._switchStateValue),
gameObject=repr(self._gameObject))
Anki.AudioEngine.Multiplexer.PostAudioSwitchState = PostAudioSwitchState
del PostAudioSwitchState
class PostAudioParameter(object):
"Generated message-passing message."
__slots__ = (
'_parameter', # Anki.AudioMetaData.GameParameter.ParameterType
'_parameterValue', # float_32
'_gameObject', # Anki.AudioMetaData.GameObjectType
'_timeInMilliSeconds', # int_32
'_curve', # Anki.AudioEngine.Multiplexer.CurveType
)
@property
def parameter(self):
"Anki.AudioMetaData.GameParameter.ParameterType parameter struct property."
return self._parameter
@parameter.setter
def parameter(self, value):
self._parameter = msgbuffers.validate_integer(
'PostAudioParameter.parameter', value, 0, 4294967295)
@property
def parameterValue(self):
"float_32 parameterValue struct property."
return self._parameterValue
@parameterValue.setter
def parameterValue(self, value):
self._parameterValue = msgbuffers.validate_float(
'PostAudioParameter.parameterValue', value, 'f')
@property
def gameObject(self):
"Anki.AudioMetaData.GameObjectType gameObject struct property."
return self._gameObject
@gameObject.setter
def gameObject(self, value):
self._gameObject = msgbuffers.validate_integer(
'PostAudioParameter.gameObject', value, 0, 4294967295)
@property
def timeInMilliSeconds(self):
"int_32 timeInMilliSeconds struct property."
return self._timeInMilliSeconds
@timeInMilliSeconds.setter
def timeInMilliSeconds(self, value):
self._timeInMilliSeconds = msgbuffers.validate_integer(
'PostAudioParameter.timeInMilliSeconds', value, -2147483648, 2147483647)
@property
def curve(self):
"Anki.AudioEngine.Multiplexer.CurveType curve struct property."
return self._curve
@curve.setter
def curve(self, value):
self._curve = msgbuffers.validate_integer(
'PostAudioParameter.curve', value, 0, 255)
def __init__(self, parameter=Anki.AudioMetaData.GameParameter.ParameterType.Behavior_Cubes_Stacked, parameterValue=0.0, gameObject=Anki.AudioMetaData.GameObjectType.Invalid, timeInMilliSeconds=0, curve=Anki.AudioEngine.Multiplexer.CurveType.Linear):
self.parameter = parameter
self.parameterValue = parameterValue
self.gameObject = gameObject
self.timeInMilliSeconds = timeInMilliSeconds
self.curve = curve
@classmethod
def unpack(cls, buffer):
"Reads a new PostAudioParameter from the given buffer."
reader = msgbuffers.BinaryReader(buffer)
value = cls.unpack_from(reader)
if reader.tell() != len(reader):
raise msgbuffers.ReadError(
('PostAudioParameter.unpack received a buffer of length {length}, ' +
'but only {position} bytes were read.').format(
length=len(reader), position=reader.tell()))
return value
@classmethod
def unpack_from(cls, reader):
"Reads a new PostAudioParameter from the given BinaryReader."
_parameter = reader.read('I')
_parameterValue = reader.read('f')
_gameObject = reader.read('I')
_timeInMilliSeconds = reader.read('i')
_curve = reader.read('B')
return cls(_parameter, _parameterValue, _gameObject, _timeInMilliSeconds, _curve)
def pack(self):
"Writes the current PostAudioParameter, returning bytes."
writer = msgbuffers.BinaryWriter()
self.pack_to(writer)
return writer.dumps()
def pack_to(self, writer):
"Writes the current PostAudioParameter to the given BinaryWriter."
writer.write(self._parameter, 'I')
writer.write(self._parameterValue, 'f')
writer.write(self._gameObject, 'I')
writer.write(self._timeInMilliSeconds, 'i')
writer.write(self._curve, 'B')
def __eq__(self, other):
if type(self) is type(other):
return (self._parameter == other._parameter and
self._parameterValue == other._parameterValue and
self._gameObject == other._gameObject and
self._timeInMilliSeconds == other._timeInMilliSeconds and
self._curve == other._curve)
else:
return NotImplemented
def __ne__(self, other):
if type(self) is type(other):
return not self.__eq__(other)
else:
return NotImplemented
def __len__(self):
return (msgbuffers.size(self._parameter, 'I') +
msgbuffers.size(self._parameterValue, 'f') +
msgbuffers.size(self._gameObject, 'I') +
msgbuffers.size(self._timeInMilliSeconds, 'i') +
msgbuffers.size(self._curve, 'B'))
def __str__(self):
return '{type}(parameter={parameter}, parameterValue={parameterValue}, gameObject={gameObject}, timeInMilliSeconds={timeInMilliSeconds}, curve={curve})'.format(
type=type(self).__name__,
parameter=self._parameter,
parameterValue=self._parameterValue,
gameObject=self._gameObject,
timeInMilliSeconds=self._timeInMilliSeconds,
curve=self._curve)
def __repr__(self):
return '{type}(parameter={parameter}, parameterValue={parameterValue}, gameObject={gameObject}, timeInMilliSeconds={timeInMilliSeconds}, curve={curve})'.format(
type=type(self).__name__,
parameter=repr(self._parameter),
parameterValue=repr(self._parameterValue),
gameObject=repr(self._gameObject),
timeInMilliSeconds=repr(self._timeInMilliSeconds),
curve=repr(self._curve))
Anki.AudioEngine.Multiplexer.PostAudioParameter = PostAudioParameter
del PostAudioParameter
class PostAudioMusicState(object):
"Generated message-passing message."
__slots__ = (
'_stateValue', # Anki.AudioMetaData.GameState.GenericState
'_interrupt', # bool
'_minDurationInMilliSeconds', # uint_32
)
@property
def stateValue(self):
"Anki.AudioMetaData.GameState.GenericState stateValue struct property."
return self._stateValue
@stateValue.setter
def stateValue(self, value):
self._stateValue = msgbuffers.validate_integer(
'PostAudioMusicState.stateValue', value, 0, 4294967295)
@property
def interrupt(self):
"bool interrupt struct property."
return self._interrupt
@interrupt.setter
def interrupt(self, value):
self._interrupt = msgbuffers.validate_bool(
'PostAudioMusicState.interrupt', value)
@property
def minDurationInMilliSeconds(self):
"uint_32 minDurationInMilliSeconds struct property."
return self._minDurationInMilliSeconds
@minDurationInMilliSeconds.setter
def minDurationInMilliSeconds(self, value):
self._minDurationInMilliSeconds = msgbuffers.validate_integer(
'PostAudioMusicState.minDurationInMilliSeconds', value, 0, 4294967295)
def __init__(self, stateValue=Anki.AudioMetaData.GameState.GenericState.Invalid, interrupt=False, minDurationInMilliSeconds=0):
self.stateValue = stateValue
self.interrupt = interrupt
self.minDurationInMilliSeconds = minDurationInMilliSeconds
@classmethod
def unpack(cls, buffer):
"Reads a new PostAudioMusicState from the given buffer."
reader = msgbuffers.BinaryReader(buffer)
value = cls.unpack_from(reader)
if reader.tell() != len(reader):
raise msgbuffers.ReadError(
('PostAudioMusicState.unpack received a buffer of length {length}, ' +
'but only {position} bytes were read.').format(
length=len(reader), position=reader.tell()))
return value
@classmethod
def unpack_from(cls, reader):
"Reads a new PostAudioMusicState from the given BinaryReader."
_stateValue = reader.read('I')
_interrupt = bool(reader.read('b'))
_minDurationInMilliSeconds = reader.read('I')
return cls(_stateValue, _interrupt, _minDurationInMilliSeconds)
def pack(self):
"Writes the current PostAudioMusicState, returning bytes."
writer = msgbuffers.BinaryWriter()
self.pack_to(writer)
return writer.dumps()
def pack_to(self, writer):
"Writes the current PostAudioMusicState to the given BinaryWriter."
writer.write(self._stateValue, 'I')
writer.write(int(self._interrupt), 'b')
writer.write(self._minDurationInMilliSeconds, 'I')
def __eq__(self, other):
if type(self) is type(other):
return (self._stateValue == other._stateValue and
self._interrupt == other._interrupt and
self._minDurationInMilliSeconds == other._minDurationInMilliSeconds)
else:
return NotImplemented
def __ne__(self, other):
if type(self) is type(other):
return not self.__eq__(other)
else:
return NotImplemented
def __len__(self):
return (msgbuffers.size(self._stateValue, 'I') +
msgbuffers.size(self._interrupt, 'b') +
msgbuffers.size(self._minDurationInMilliSeconds, 'I'))
def __str__(self):
return '{type}(stateValue={stateValue}, interrupt={interrupt}, minDurationInMilliSeconds={minDurationInMilliSeconds})'.format(
type=type(self).__name__,
stateValue=self._stateValue,
interrupt=self._interrupt,
minDurationInMilliSeconds=self._minDurationInMilliSeconds)
def __repr__(self):
return '{type}(stateValue={stateValue}, interrupt={interrupt}, minDurationInMilliSeconds={minDurationInMilliSeconds})'.format(
type=type(self).__name__,
stateValue=repr(self._stateValue),
interrupt=repr(self._interrupt),
minDurationInMilliSeconds=repr(self._minDurationInMilliSeconds))
Anki.AudioEngine.Multiplexer.PostAudioMusicState = PostAudioMusicState
del PostAudioMusicState
@@ -0,0 +1,71 @@
# Copyright (c) 2016-2017 Anki, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License in the file LICENSE.txt or at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""
Autogenerated python message buffer code.
Source: clad/audio/audioMessageTypes.clad
Full command line: ../tools/message-buffers/emitters/Python_emitter.py -C ./src/ -I ../robot/clad/src/ ../coretech/vision/clad/src/ ../coretech/common/clad/src/ ../lib/util/source/anki/clad -o ../generated/cladPython// clad/audio/audioMessageTypes.clad
"""
from __future__ import absolute_import
from __future__ import print_function
def _modify_path():
import inspect, os, sys
search_paths = [
'../..',
'../../../../tools/message-buffers/support/python',
]
currentpath = os.path.abspath(os.path.dirname(inspect.getfile(inspect.currentframe())))
for search_path in search_paths:
search_path = os.path.normpath(os.path.abspath(os.path.realpath(os.path.join(currentpath, search_path))))
if search_path not in sys.path:
sys.path.insert(0, search_path)
_modify_path()
import msgbuffers
Anki = msgbuffers.Namespace()
Anki.AudioEngine = msgbuffers.Namespace()
Anki.AudioEngine.Multiplexer = msgbuffers.Namespace()
class AudioCallbackFlag(object):
"Automatically-generated uint_8 enumeration."
EventNone = 0x0
EventDuration = 0x1
EventMarker = 0x2
EventComplete = 0x4
EventAll = 0x7
EventError = 0xff
Anki.AudioEngine.Multiplexer.AudioCallbackFlag = AudioCallbackFlag
del AudioCallbackFlag
class CurveType(object):
"Automatically-generated uint_8 enumeration."
Linear = 0
SCurve = 1
InversedSCurve = 2
Sine = 3
SineReciprocal = 4
Exp1 = 5
Exp3 = 6
Log1 = 7
Log3 = 8
Anki.AudioEngine.Multiplexer.CurveType = CurveType
del CurveType
@@ -0,0 +1,87 @@
# Copyright (c) 2016-2017 Anki, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License in the file LICENSE.txt or at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""
Autogenerated python message buffer code.
Source: clad/audio/audioParameterTypes.clad
Full command line: ../tools/message-buffers/emitters/Python_emitter.py -C ./src/ -I ../robot/clad/src/ ../coretech/vision/clad/src/ ../coretech/common/clad/src/ ../lib/util/source/anki/clad -o ../generated/cladPython// clad/audio/audioParameterTypes.clad
"""
from __future__ import absolute_import
from __future__ import print_function
def _modify_path():
import inspect, os, sys
search_paths = [
'../..',
'../../../../tools/message-buffers/support/python',
]
currentpath = os.path.abspath(os.path.dirname(inspect.getfile(inspect.currentframe())))
for search_path in search_paths:
search_path = os.path.normpath(os.path.abspath(os.path.realpath(os.path.join(currentpath, search_path))))
if search_path not in sys.path:
sys.path.insert(0, search_path)
_modify_path()
import msgbuffers
Anki = msgbuffers.Namespace()
Anki.AudioMetaData = msgbuffers.Namespace()
Anki.AudioMetaData.GameParameter = msgbuffers.Namespace()
class ParameterType(object):
"Automatically-generated uint_32 enumeration."
Behavior_Cubes_Stacked = 871787998
Behavior_Lift_Cube = 1379688411
Behavior_Request_Game = 4023609046
Cozmo_Singing_Phaser = 265118809
Cozmo_Singing_Tremolo = 1391957216
Cozmo_Singing_Vibrato = 3255781855
Dev_Tone_Freq = 2324555758
Event_Volume = 3530059848
External_Name_Duration = 2145805753
External_Process_Pitch = 2027863301
Invalid = 0
Mood = 3128647864
Music_Mood = 1579946944
Music_Vc_Mode = 3919823198
Music_Volume = 1006694123
Mvt_Effort_Pitch = 3281296278
Mvt_Effort_Volume = 537268346
Mvt_Speed = 3464961452
Nurture_Energy = 2719284537
Nurture_Play = 1634287311
Nurture_Repair = 3081923682
Relationship = 3723222599
Robot_Volume = 1669075520
Sfx_Charge = 3433595557
Sfx_Cube_Feeding = 2154703351
Sfx_Volume = 1564184899
Ss_Air_Fear = 1351367891
Ss_Air_Freefall = 3002758120
Ss_Air_Fury = 1029930033
Ss_Air_Month = 2648548617
Ss_Air_Presence = 3847924954
Ss_Air_Rpm = 822163944
Ss_Air_Size = 3074696722
Ss_Air_Storm = 3715662592
Ss_Air_Timeofday = 3203397129
Ss_Air_Turbulence = 4160247818
Ui_Volume = 1719345792
Vo_Volume = 2295491857
Anki.AudioMetaData.GameParameter.ParameterType = ParameterType
del ParameterType
@@ -0,0 +1,56 @@
# Copyright (c) 2016-2017 Anki, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License in the file LICENSE.txt or at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""
Autogenerated python message buffer code.
Source: clad/audio/audioSoundbanks.clad
Full command line: ../tools/message-buffers/emitters/Python_emitter.py -C ./src/ -I ../robot/clad/src/ ../coretech/vision/clad/src/ ../coretech/common/clad/src/ ../lib/util/source/anki/clad -o ../generated/cladPython// clad/audio/audioSoundbanks.clad
"""
from __future__ import absolute_import
from __future__ import print_function
def _modify_path():
import inspect, os, sys
search_paths = [
'../..',
'../../../../tools/message-buffers/support/python',
]
currentpath = os.path.abspath(os.path.dirname(inspect.getfile(inspect.currentframe())))
for search_path in search_paths:
search_path = os.path.normpath(os.path.abspath(os.path.realpath(os.path.join(currentpath, search_path))))
if search_path not in sys.path:
sys.path.insert(0, search_path)
_modify_path()
import msgbuffers
Anki = msgbuffers.Namespace()
Anki.AudioMetaData = msgbuffers.Namespace()
Anki.AudioMetaData.SoundBank = msgbuffers.Namespace()
class BankType(object):
"Automatically-generated uint_32 enumeration."
Cozmo = 2386142475
Dev_Debug = 1453038702
Init = 1355168291
Invalid = 0
Music = 3991942870
Sfx = 393239870
Ui = 1551306167
Anki.AudioMetaData.SoundBank.BankType = BankType
del BankType
@@ -0,0 +1,162 @@
# Copyright (c) 2016-2017 Anki, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License in the file LICENSE.txt or at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""
Autogenerated python message buffer code.
Source: clad/audio/audioStateTypes.clad
Full command line: ../tools/message-buffers/emitters/Python_emitter.py -C ./src/ -I ../robot/clad/src/ ../coretech/vision/clad/src/ ../coretech/common/clad/src/ ../lib/util/source/anki/clad -o ../generated/cladPython// clad/audio/audioStateTypes.clad
"""
from __future__ import absolute_import
from __future__ import print_function
def _modify_path():
import inspect, os, sys
search_paths = [
'../..',
'../../../../tools/message-buffers/support/python',
]
currentpath = os.path.abspath(os.path.dirname(inspect.getfile(inspect.currentframe())))
for search_path in search_paths:
search_path = os.path.normpath(os.path.abspath(os.path.realpath(os.path.join(currentpath, search_path))))
if search_path not in sys.path:
sys.path.insert(0, search_path)
_modify_path()
import msgbuffers
Anki = msgbuffers.Namespace()
Anki.AudioMetaData = msgbuffers.Namespace()
Anki.AudioMetaData.GameState = msgbuffers.Namespace()
class External_Language(object):
"Automatically-generated uint_32 enumeration."
English = 3383237639
French = 3133094709
German = 4290373403
Invalid = 0
Japanese = 2008704848
Anki.AudioMetaData.GameState.External_Language = External_Language
del External_Language
class External_Name(object):
"Automatically-generated uint_32 enumeration."
Design_Pre_Generated_Name = 309148475
External_Name_On = 4053302206
Invalid = 0
Unit_Test_Mock = 3937202207
Anki.AudioMetaData.GameState.External_Name = External_Name
del External_Name
class GenericState(object):
"Automatically-generated uint_32 enumeration."
Invalid = 0
Anki.AudioMetaData.GameState.GenericState = GenericState
del GenericState
class Mood(object):
"Automatically-generated uint_32 enumeration."
Happy = 1427264549
Invalid = 0
Neutral = 670611050
Sad = 443572635
Anki.AudioMetaData.GameState.Mood = Mood
del Mood
class Music(object):
"Automatically-generated uint_32 enumeration."
Alarm_Clock = 3653788539
Codelab = 730889831
Connectivity = 1264085260
Cozmo_Says = 2338198982
Cozmo_Says_Speaking = 739906331
Freeplay = 150865113
Invalid = 0
Minigame__Generic = 713847863
Minigame__Keep_Away = 579475288
Minigame__Keep_Away_Between_Rounds = 274928299
Minigame__Keep_Away_Player_Fail = 2987088935
Minigame__Keep_Away_Pounce = 3317810949
Minigame__Keep_Away_Tension = 22918831
Minigame__Meet_Cozmo = 1580491744
Minigame__Meet_Cozmo_Say_Name = 2582275442
Minigame__Memory_Match = 1731176119
Minigame__Memory_Match_Fanfare = 2262040721
Minigame__Memory_Match_Full_Life = 1451808254
Minigame__Memory_Match_No_Lives = 2282047959
Minigame__Quick_Tap_Between_Rounds = 2865488202
Minigame__Quick_Tap_Round1 = 3954622599
Minigame__Quick_Tap_Round2 = 3954622596
Minigame__Quick_Tap_Round3 = 3954622597
Minigame__Quick_Tap_Win = 2079381016
Minigame__Ride_Along = 3234084100
Minigame__Setup = 1317044071
Nurture_Repair = 3081923682
Onboarding = 3360093794
Onboarding__Core_Upgrades = 102695299
Onboarding__Meet_Cozmo = 4195748652
Onboarding__Meet_Cozmo_Say_Name = 3775866302
Onboarding__Play_Tab = 2360281734
Onboarding__Show_Cube = 3253479049
Pause = 3092587493
Silent = 3160623154
Sleep = 3671647190
Spark = 155090436
Anki.AudioMetaData.GameState.Music = Music
del Music
class Music_Dimmer(object):
"Automatically-generated uint_32 enumeration."
Invalid = 0
Music_Dimmed = 920031429
Music_Full = 2880332950
Anki.AudioMetaData.GameState.Music_Dimmer = Music_Dimmer
del Music_Dimmer
class StateGroupType(object):
"Automatically-generated uint_32 enumeration."
External_Language = 944413709
External_Name = 2869506494
Invalid = 0
Mood = 3128647864
Music = 3991942870
Music_Dimmer = 920031443
Voice_Commands_Mode = 522893720
Anki.AudioMetaData.GameState.StateGroupType = StateGroupType
del StateGroupType
class Voice_Commands_Mode(object):
"Automatically-generated uint_32 enumeration."
Invalid = 0
Vc_Mode_Off = 1444240748
Vc_Mode_On = 2411592966
Anki.AudioMetaData.GameState.Voice_Commands_Mode = Voice_Commands_Mode
del Voice_Commands_Mode
@@ -0,0 +1,415 @@
# Copyright (c) 2016-2017 Anki, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License in the file LICENSE.txt or at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""
Autogenerated python message buffer code.
Source: clad/audio/audioSwitchTypes.clad
Full command line: ../tools/message-buffers/emitters/Python_emitter.py -C ./src/ -I ../robot/clad/src/ ../coretech/vision/clad/src/ ../coretech/common/clad/src/ ../lib/util/source/anki/clad -o ../generated/cladPython// clad/audio/audioSwitchTypes.clad
"""
from __future__ import absolute_import
from __future__ import print_function
def _modify_path():
import inspect, os, sys
search_paths = [
'../..',
'../../../../tools/message-buffers/support/python',
]
currentpath = os.path.abspath(os.path.dirname(inspect.getfile(inspect.currentframe())))
for search_path in search_paths:
search_path = os.path.normpath(os.path.abspath(os.path.realpath(os.path.join(currentpath, search_path))))
if search_path not in sys.path:
sys.path.insert(0, search_path)
_modify_path()
import msgbuffers
Anki = msgbuffers.Namespace()
Anki.AudioMetaData = msgbuffers.Namespace()
Anki.AudioMetaData.SwitchState = msgbuffers.Namespace()
class Codelab__Music_Tiny_Orchestra(object):
"Automatically-generated uint_32 enumeration."
Invalid = 0
Tiny_Orchestra_Bass_Mode_1_Off = 2773389205
Tiny_Orchestra_Bass_Mode_1_On = 4225872937
Tiny_Orchestra_Bass_Mode_2_Off = 3114422790
Tiny_Orchestra_Bass_Mode_2_On = 2510905384
Tiny_Orchestra_Bass_Mode_3_Off = 1797181875
Tiny_Orchestra_Bass_Mode_3_On = 36806655
Tiny_Orchestra_Glock_Pluck_Mode_1_Off = 1674194378
Tiny_Orchestra_Glock_Pluck_Mode_1_On = 2421905196
Tiny_Orchestra_Glock_Pluck_Mode_2_Off = 4210083577
Tiny_Orchestra_Glock_Pluck_Mode_2_On = 3631119949
Tiny_Orchestra_Glock_Pluck_Mode_3_Off = 2569343836
Tiny_Orchestra_Glock_Pluck_Mode_3_On = 1273367574
Tiny_Orchestra_Strings_Mode_1_Off = 1597550140
Tiny_Orchestra_Strings_Mode_1_On = 2524543094
Tiny_Orchestra_Strings_Mode_2_Off = 104978871
Tiny_Orchestra_Strings_Mode_2_On = 1209427331
Tiny_Orchestra_Strings_Mode_3_Off = 702297514
Tiny_Orchestra_Strings_Mode_3_On = 3673080460
Anki.AudioMetaData.SwitchState.Codelab__Music_Tiny_Orchestra = Codelab__Music_Tiny_Orchestra
del Codelab__Music_Tiny_Orchestra
class Codelab__Music_Tiny_Orchestra_Bass(object):
"Automatically-generated uint_32 enumeration."
Invalid = 0
Tiny_Orchestra_Bass_Mode_1 = 4077279363
Tiny_Orchestra_Bass_Mode_2 = 4077279360
Tiny_Orchestra_Bass_Mode_3 = 4077279361
Tiny_Orchestra_Bass_Mode_Off = 3450676341
Anki.AudioMetaData.SwitchState.Codelab__Music_Tiny_Orchestra_Bass = Codelab__Music_Tiny_Orchestra_Bass
del Codelab__Music_Tiny_Orchestra_Bass
class Codelab__Music_Tiny_Orchestra_Bass_Mode_1(object):
"Automatically-generated uint_32 enumeration."
Invalid = 0
Tiny_Orchestra_Bass_Mode_1_Off = 2773389205
Tiny_Orchestra_Bass_Mode_1_On = 4225872937
Anki.AudioMetaData.SwitchState.Codelab__Music_Tiny_Orchestra_Bass_Mode_1 = Codelab__Music_Tiny_Orchestra_Bass_Mode_1
del Codelab__Music_Tiny_Orchestra_Bass_Mode_1
class Codelab__Music_Tiny_Orchestra_Bass_Mode_2(object):
"Automatically-generated uint_32 enumeration."
Invalid = 0
Tiny_Orchestra_Bass_Mode_2_Off = 3114422790
Tiny_Orchestra_Bass_Mode_2_On = 2510905384
Anki.AudioMetaData.SwitchState.Codelab__Music_Tiny_Orchestra_Bass_Mode_2 = Codelab__Music_Tiny_Orchestra_Bass_Mode_2
del Codelab__Music_Tiny_Orchestra_Bass_Mode_2
class Codelab__Music_Tiny_Orchestra_Bass_Mode_3(object):
"Automatically-generated uint_32 enumeration."
Invalid = 0
Tiny_Orchestra_Bass_Mode_3_Off = 1797181875
Tiny_Orchestra_Bass_Mode_3_On = 36806655
Anki.AudioMetaData.SwitchState.Codelab__Music_Tiny_Orchestra_Bass_Mode_3 = Codelab__Music_Tiny_Orchestra_Bass_Mode_3
del Codelab__Music_Tiny_Orchestra_Bass_Mode_3
class Codelab__Music_Tiny_Orchestra_Glock_Pluck(object):
"Automatically-generated uint_32 enumeration."
Invalid = 0
Tiny_Orchestra_Glock_Pluck_Mode_1 = 1695515796
Tiny_Orchestra_Glock_Pluck_Mode_2 = 1695515799
Tiny_Orchestra_Glock_Pluck_Mode_3 = 1695515798
Tiny_Orchestra_Glock_Pluck_Mode_Off = 2017008174
Anki.AudioMetaData.SwitchState.Codelab__Music_Tiny_Orchestra_Glock_Pluck = Codelab__Music_Tiny_Orchestra_Glock_Pluck
del Codelab__Music_Tiny_Orchestra_Glock_Pluck
class Codelab__Music_Tiny_Orchestra_Glock_Pluck_Mode_1(object):
"Automatically-generated uint_32 enumeration."
Invalid = 0
Tiny_Orchestra_Glock_Pluck_Mode_1_Off = 1674194378
Tiny_Orchestra_Glock_Pluck_Mode_1_On = 2421905196
Anki.AudioMetaData.SwitchState.Codelab__Music_Tiny_Orchestra_Glock_Pluck_Mode_1 = Codelab__Music_Tiny_Orchestra_Glock_Pluck_Mode_1
del Codelab__Music_Tiny_Orchestra_Glock_Pluck_Mode_1
class Codelab__Music_Tiny_Orchestra_Glock_Pluck_Mode_2(object):
"Automatically-generated uint_32 enumeration."
Invalid = 0
Tiny_Orchestra_Glock_Pluck_Mode_2_Off = 4210083577
Tiny_Orchestra_Glock_Pluck_Mode_2_On = 3631119949
Anki.AudioMetaData.SwitchState.Codelab__Music_Tiny_Orchestra_Glock_Pluck_Mode_2 = Codelab__Music_Tiny_Orchestra_Glock_Pluck_Mode_2
del Codelab__Music_Tiny_Orchestra_Glock_Pluck_Mode_2
class Codelab__Music_Tiny_Orchestra_Glock_Pluck_Mode_3(object):
"Automatically-generated uint_32 enumeration."
Invalid = 0
Tiny_Orchestra_Glock_Pluck_Mode_3_Off = 2569343836
Tiny_Orchestra_Glock_Pluck_Mode_3_On = 1273367574
Anki.AudioMetaData.SwitchState.Codelab__Music_Tiny_Orchestra_Glock_Pluck_Mode_3 = Codelab__Music_Tiny_Orchestra_Glock_Pluck_Mode_3
del Codelab__Music_Tiny_Orchestra_Glock_Pluck_Mode_3
class Codelab__Music_Tiny_Orchestra_Strings(object):
"Automatically-generated uint_32 enumeration."
Invalid = 0
Tiny_Orchestra_Strings_Mode_1 = 1790990774
Tiny_Orchestra_Strings_Mode_2 = 1790990773
Tiny_Orchestra_Strings_Mode_3 = 1790990772
Tiny_Orchestra_Strings_Mode_Off = 3180178332
Anki.AudioMetaData.SwitchState.Codelab__Music_Tiny_Orchestra_Strings = Codelab__Music_Tiny_Orchestra_Strings
del Codelab__Music_Tiny_Orchestra_Strings
class Codelab__Music_Tiny_Orchestra_Strings_Mode_1(object):
"Automatically-generated uint_32 enumeration."
Invalid = 0
Tiny_Orchestra_Strings_Mode_1_Off = 1597550140
Tiny_Orchestra_Strings_Mode_1_On = 2524543094
Anki.AudioMetaData.SwitchState.Codelab__Music_Tiny_Orchestra_Strings_Mode_1 = Codelab__Music_Tiny_Orchestra_Strings_Mode_1
del Codelab__Music_Tiny_Orchestra_Strings_Mode_1
class Codelab__Music_Tiny_Orchestra_Strings_Mode_2(object):
"Automatically-generated uint_32 enumeration."
Invalid = 0
Tiny_Orchestra_Strings_Mode_2_Off = 104978871
Tiny_Orchestra_Strings_Mode_2_On = 1209427331
Anki.AudioMetaData.SwitchState.Codelab__Music_Tiny_Orchestra_Strings_Mode_2 = Codelab__Music_Tiny_Orchestra_Strings_Mode_2
del Codelab__Music_Tiny_Orchestra_Strings_Mode_2
class Codelab__Music_Tiny_Orchestra_Strings_Mode_3(object):
"Automatically-generated uint_32 enumeration."
Invalid = 0
Tiny_Orchestra_Strings_Mode_3_Off = 702297514
Tiny_Orchestra_Strings_Mode_3_On = 3673080460
Anki.AudioMetaData.SwitchState.Codelab__Music_Tiny_Orchestra_Strings_Mode_3 = Codelab__Music_Tiny_Orchestra_Strings_Mode_3
del Codelab__Music_Tiny_Orchestra_Strings_Mode_3
class Cozmo_Sings_100Bpm(object):
"Automatically-generated uint_32 enumeration."
Cozmo_Sings_Beautiful_Dreamer = 366264019
Cozmo_Sings_Beethovens_5Th = 234196460
Cozmo_Sings_Bingo = 2671798574
Cozmo_Sings_Buffalo_Gals = 1616439696
Cozmo_Sings_Camptown_Races = 2068892721
Cozmo_Sings_Can_Can_1 = 1565293210
Cozmo_Sings_Can_Can_2 = 1565293209
Cozmo_Sings_Farmer_In_The_Dell = 3199213520
Cozmo_Sings_Itsy_Bitsy_Spider = 4216855774
Cozmo_Sings_London_Bridge = 1890869377
Cozmo_Sings_Mountain_King = 2556694018
Cozmo_Sings_Muss_I_Denn = 2520896685
Cozmo_Sings_Pop_Goes_The_Weasel = 2629521585
Cozmo_Sings_Row_Your_Boat = 468566904
Cozmo_Sings_Ta_Ra_Ra_Boom = 2367266190
Cozmo_Sings_Tisket_Tasket = 2168319140
Cozmo_Sings_Yellow_Rose = 3186274273
Invalid = 0
Anki.AudioMetaData.SwitchState.Cozmo_Sings_100Bpm = Cozmo_Sings_100Bpm
del Cozmo_Sings_100Bpm
class Cozmo_Sings_120Bpm(object):
"Automatically-generated uint_32 enumeration."
Cozmo_Sings_Cozmambo = 885738211
Cozmo_Sings_Entry_Of_The_Gladiators = 2101741982
Cozmo_Sings_Hello_My_Baby = 1653598059
Cozmo_Sings_Hush_Little_Baby = 4192423907
Cozmo_Sings_La_Paloma = 2263560367
Cozmo_Sings_Moonlight_Bay = 3990987963
Cozmo_Sings_Ode_To_Joy = 277478768
Cozmo_Sings_Sakura = 1066913866
Cozmo_Sings_Silvery_Moon = 2709516065
Cozmo_Sings_Toccata = 2295405948
Cozmo_Sings_Turkey_In_The_Straw = 222542119
Cozmo_Sings_Twinkle_Twinkle = 2925972690
Cozmo_Sings_Wild_About_Harry = 2245203260
Invalid = 0
Anki.AudioMetaData.SwitchState.Cozmo_Sings_120Bpm = Cozmo_Sings_120Bpm
del Cozmo_Sings_120Bpm
class Cozmo_Sings_80Bpm(object):
"Automatically-generated uint_32 enumeration."
Cozmo_Sings_Aba_Daba = 2234458138
Cozmo_Sings_Danny_Boy = 3740392146
Cozmo_Sings_Farmer_In_The_Dell = 3199213520
Cozmo_Sings_Frere_Jacques = 1503161152
Cozmo_Sings_Habanera = 2657364191
Cozmo_Sings_Mary_Had_A_Little_Lamb = 4246470244
Cozmo_Sings_Muffin_Man = 197233699
Cozmo_Sings_Mulberry_Bush = 2808835548
Cozmo_Sings_Pachebel_Canon = 553164015
Cozmo_Sings_Take_Me_Out_To_The_Ballgame = 330639210
Cozmo_Sings_Vivaldi_Spring = 3538265926
Cozmo_Sings_Water_Music = 583110970
Cozmo_Sings_William_Tell = 2911111070
Cozmo_Sings_Yankee_Doodle = 3906943052
Invalid = 0
Anki.AudioMetaData.SwitchState.Cozmo_Sings_80Bpm = Cozmo_Sings_80Bpm
del Cozmo_Sings_80Bpm
class Cozmo_Voice_Processing(object):
"Automatically-generated uint_32 enumeration."
Invalid = 0
Name = 797654004
Sentence = 906532866
Unprocessed = 860658140
Anki.AudioMetaData.SwitchState.Cozmo_Voice_Processing = Cozmo_Voice_Processing
del Cozmo_Voice_Processing
class External(object):
"Automatically-generated uint_32 enumeration."
External_Long = 3001056757
External_Maximum = 1931150551
External_Medium = 3619992510
External_Short = 1727626579
Invalid = 0
Anki.AudioMetaData.SwitchState.External = External
del External
class Freeplay_Mood(object):
"Automatically-generated uint_32 enumeration."
Arcade = 1946377065
Bored = 2890913445
Busy = 1427625958
Chill = 4294400669
Cubeinteract = 889740396
Dancing = 386094975
Guard_Dog = 1030326287
Happy = 1427264549
Hiking = 296159617
Invalid = 0
Neutral = 670611050
Neutral_Cubes_Stacked = 2172443987
Neutral_Lift_Cube = 1603627138
Neutral_Request_Game = 3496250545
Nurture_Feeding = 2320504975
Nurture_Nirvana = 3261805104
Nurture_Repair = 3081923682
Nurture_Severe = 1058497985
Sleep = 3671647190
Anki.AudioMetaData.SwitchState.Freeplay_Mood = Freeplay_Mood
del Freeplay_Mood
class Gameplay_Round(object):
"Automatically-generated uint_32 enumeration."
Invalid = 0
Round_00 = 4039654994
Round_01 = 4039654995
Round_02 = 4039654992
Round_03 = 4039654993
Round_04 = 4039654998
Round_05 = 4039654999
Round_06 = 4039654996
Round_07 = 4039654997
Round_08 = 4039655002
Round_09 = 4039655003
Round_10 = 4056432581
Anki.AudioMetaData.SwitchState.Gameplay_Round = Gameplay_Round
del Gameplay_Round
class GenericSwitch(object):
"Automatically-generated uint_32 enumeration."
Invalid = 0
Anki.AudioMetaData.SwitchState.GenericSwitch = GenericSwitch
del GenericSwitch
class Mood(object):
"Automatically-generated uint_32 enumeration."
Invalid = 0
Mood_Happy = 457607035
Mood_Neutral = 3970296952
Mood_Sad = 777739821
Anki.AudioMetaData.SwitchState.Mood = Mood
del Mood
class Relationship(object):
"Automatically-generated uint_32 enumeration."
Invalid = 0
Realtionship_Bff = 743952678
Realtionship_Friend = 1061927592
Relationship_Stranger = 3087192196
Anki.AudioMetaData.SwitchState.Relationship = Relationship
del Relationship
class Sparked(object):
"Automatically-generated uint_32 enumeration."
Fun = 982472036
Invalid = 0
Pyramid = 797712787
Sneaky = 468648200
Workout = 1875882538
Anki.AudioMetaData.SwitchState.Sparked = Sparked
del Sparked
class SwitchGroupType(object):
"Automatically-generated uint_32 enumeration."
Codelab__Music_Tiny_Orchestra = 981129199
Codelab__Music_Tiny_Orchestra_Bass = 57798143
Codelab__Music_Tiny_Orchestra_Bass_Mode_1 = 3356335735
Codelab__Music_Tiny_Orchestra_Bass_Mode_2 = 3356335732
Codelab__Music_Tiny_Orchestra_Bass_Mode_3 = 3356335733
Codelab__Music_Tiny_Orchestra_Glock_Pluck = 294713538
Codelab__Music_Tiny_Orchestra_Glock_Pluck_Mode_1 = 1120265808
Codelab__Music_Tiny_Orchestra_Glock_Pluck_Mode_2 = 1120265811
Codelab__Music_Tiny_Orchestra_Glock_Pluck_Mode_3 = 1120265810
Codelab__Music_Tiny_Orchestra_Strings = 802212004
Codelab__Music_Tiny_Orchestra_Strings_Mode_1 = 1004765386
Codelab__Music_Tiny_Orchestra_Strings_Mode_2 = 1004765385
Codelab__Music_Tiny_Orchestra_Strings_Mode_3 = 1004765384
Cozmo_Sings_100Bpm = 3759662965
Cozmo_Sings_120Bpm = 2987768599
Cozmo_Sings_80Bpm = 3366294904
Cozmo_Voice_Processing = 366280094
External = 1442075084
Freeplay_Mood = 2205807877
Gameplay_Round = 2536359484
Invalid = 0
Mood = 3128647864
Relationship = 3723222599
Sparked = 62349551
World_Event = 846944294
Anki.AudioMetaData.SwitchState.SwitchGroupType = SwitchGroupType
del SwitchGroupType
class World_Event(object):
"Automatically-generated uint_32 enumeration."
Cubes_Stacked = 2547007631
Invalid = 0
Lift_Cube = 3497001966
Request_Game = 2296204869
Anki.AudioMetaData.SwitchState.World_Event = World_Event
del World_Event
@@ -0,0 +1,332 @@
# Copyright (c) 2016-2017 Anki, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License in the file LICENSE.txt or at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""
Autogenerated python message buffer code.
Source: clad/audio/messageAudioClient.clad
Full command line: ../tools/message-buffers/emitters/Python_emitter.py -C ./src/ -I ../robot/clad/src/ ../coretech/vision/clad/src/ ../coretech/common/clad/src/ ../lib/util/source/anki/clad -o ../generated/cladPython// clad/audio/messageAudioClient.clad
"""
from __future__ import absolute_import
from __future__ import print_function
def _modify_path():
import inspect, os, sys
search_paths = [
'../..',
'../../../../tools/message-buffers/support/python',
]
currentpath = os.path.abspath(os.path.dirname(inspect.getfile(inspect.currentframe())))
for search_path in search_paths:
search_path = os.path.normpath(os.path.abspath(os.path.realpath(os.path.join(currentpath, search_path))))
if search_path not in sys.path:
sys.path.insert(0, search_path)
_modify_path()
import msgbuffers
Anki = msgbuffers.Namespace()
Anki.AudioEngine = msgbuffers.Namespace()
Anki.AudioEngine.Multiplexer = msgbuffers.Namespace()
Anki.AudioMetaData = msgbuffers.Namespace()
Anki.AudioMetaData.GameEvent = msgbuffers.Namespace()
Anki.AudioMetaData.GameParameter = msgbuffers.Namespace()
Anki.AudioMetaData.GameState = msgbuffers.Namespace()
Anki.AudioMetaData.SwitchState = msgbuffers.Namespace()
from clad.audio.audioCallbackMessage import Anki as _Anki
Anki.update(_Anki.deep_clone())
from clad.audio.audioMessage import Anki as _Anki
Anki.update(_Anki.deep_clone())
class MessageAudioClient(object):
"Generated message-passing union."
__slots__ = ('_tag', '_data')
class Tag(object):
"The type indicator for this union."
PostAudioEvent = 0 # Anki.AudioEngine.Multiplexer.PostAudioEvent
StopAllAudioEvents = 1 # Anki.AudioEngine.Multiplexer.StopAllAudioEvents
PostAudioGameState = 2 # Anki.AudioEngine.Multiplexer.PostAudioGameState
PostAudioSwitchState = 3 # Anki.AudioEngine.Multiplexer.PostAudioSwitchState
PostAudioParameter = 4 # Anki.AudioEngine.Multiplexer.PostAudioParameter
PostAudioMusicState = 5 # Anki.AudioEngine.Multiplexer.PostAudioMusicState
AudioCallback = 6 # Anki.AudioEngine.Multiplexer.AudioCallback
@property
def tag(self):
"The current tag for this union."
return self._tag
@property
def tag_name(self):
"The name of the current tag for this union."
if self._tag in self._tags_by_value:
return self._tags_by_value[self._tag]
else:
return None
@property
def data(self):
"The data held by this union. None if no data is set."
return self._data
@property
def PostAudioEvent(self):
"Anki.AudioEngine.Multiplexer.PostAudioEvent PostAudioEvent union property."
msgbuffers.safety_check_tag('PostAudioEvent', self._tag, self.Tag.PostAudioEvent, self._tags_by_value)
return self._data
@PostAudioEvent.setter
def PostAudioEvent(self, value):
self._data = msgbuffers.validate_object(
'MessageAudioClient.PostAudioEvent', value, Anki.AudioEngine.Multiplexer.PostAudioEvent)
self._tag = self.Tag.PostAudioEvent
@property
def StopAllAudioEvents(self):
"Anki.AudioEngine.Multiplexer.StopAllAudioEvents StopAllAudioEvents union property."
msgbuffers.safety_check_tag('StopAllAudioEvents', self._tag, self.Tag.StopAllAudioEvents, self._tags_by_value)
return self._data
@StopAllAudioEvents.setter
def StopAllAudioEvents(self, value):
self._data = msgbuffers.validate_object(
'MessageAudioClient.StopAllAudioEvents', value, Anki.AudioEngine.Multiplexer.StopAllAudioEvents)
self._tag = self.Tag.StopAllAudioEvents
@property
def PostAudioGameState(self):
"Anki.AudioEngine.Multiplexer.PostAudioGameState PostAudioGameState union property."
msgbuffers.safety_check_tag('PostAudioGameState', self._tag, self.Tag.PostAudioGameState, self._tags_by_value)
return self._data
@PostAudioGameState.setter
def PostAudioGameState(self, value):
self._data = msgbuffers.validate_object(
'MessageAudioClient.PostAudioGameState', value, Anki.AudioEngine.Multiplexer.PostAudioGameState)
self._tag = self.Tag.PostAudioGameState
@property
def PostAudioSwitchState(self):
"Anki.AudioEngine.Multiplexer.PostAudioSwitchState PostAudioSwitchState union property."
msgbuffers.safety_check_tag('PostAudioSwitchState', self._tag, self.Tag.PostAudioSwitchState, self._tags_by_value)
return self._data
@PostAudioSwitchState.setter
def PostAudioSwitchState(self, value):
self._data = msgbuffers.validate_object(
'MessageAudioClient.PostAudioSwitchState', value, Anki.AudioEngine.Multiplexer.PostAudioSwitchState)
self._tag = self.Tag.PostAudioSwitchState
@property
def PostAudioParameter(self):
"Anki.AudioEngine.Multiplexer.PostAudioParameter PostAudioParameter union property."
msgbuffers.safety_check_tag('PostAudioParameter', self._tag, self.Tag.PostAudioParameter, self._tags_by_value)
return self._data
@PostAudioParameter.setter
def PostAudioParameter(self, value):
self._data = msgbuffers.validate_object(
'MessageAudioClient.PostAudioParameter', value, Anki.AudioEngine.Multiplexer.PostAudioParameter)
self._tag = self.Tag.PostAudioParameter
@property
def PostAudioMusicState(self):
"Anki.AudioEngine.Multiplexer.PostAudioMusicState PostAudioMusicState union property."
msgbuffers.safety_check_tag('PostAudioMusicState', self._tag, self.Tag.PostAudioMusicState, self._tags_by_value)
return self._data
@PostAudioMusicState.setter
def PostAudioMusicState(self, value):
self._data = msgbuffers.validate_object(
'MessageAudioClient.PostAudioMusicState', value, Anki.AudioEngine.Multiplexer.PostAudioMusicState)
self._tag = self.Tag.PostAudioMusicState
@property
def AudioCallback(self):
"Anki.AudioEngine.Multiplexer.AudioCallback AudioCallback union property."
msgbuffers.safety_check_tag('AudioCallback', self._tag, self.Tag.AudioCallback, self._tags_by_value)
return self._data
@AudioCallback.setter
def AudioCallback(self, value):
self._data = msgbuffers.validate_object(
'MessageAudioClient.AudioCallback', value, Anki.AudioEngine.Multiplexer.AudioCallback)
self._tag = self.Tag.AudioCallback
def __init__(self, **kwargs):
if not kwargs:
self._tag = None
self._data = None
elif len(kwargs) == 1:
key, value = next(iter(kwargs.items()))
if key not in self._tags_by_name:
raise TypeError("'{argument}' is an invalid keyword argument for this method.".format(argument=key))
# calls the correct property
setattr(self, key, value)
else:
raise TypeError('This method only accepts up to one keyword argument.')
@classmethod
def unpack(cls, buffer):
"Reads a new MessageAudioClient from the given buffer."
reader = msgbuffers.BinaryReader(buffer)
value = cls.unpack_from(reader)
if reader.tell() != len(reader):
raise msgbuffers.ReadError(
('MessageAudioClient.unpack received a buffer of length {length}, ' +
'but only {position} bytes were read.').format(
length=len(reader), position=reader.tell()))
return value
@classmethod
def unpack_from(cls, reader):
"Reads a new MessageAudioClient from the given BinaryReader."
tag = reader.read('B')
if tag in cls._tags_by_value:
value = cls()
setattr(value, cls._tags_by_value[tag], cls._tag_unpack_methods[tag](reader))
return value
else:
raise ValueError('MessageAudioClient attempted to unpack unknown tag {tag}.'.format(tag=tag))
def pack(self):
"Writes the current MessageAudioClient, returning bytes."
writer = msgbuffers.BinaryWriter()
self.pack_to(writer)
return writer.dumps()
def pack_to(self, writer):
"Writes the current SampleUnion to the given BinaryWriter."
if self._tag in self._tags_by_value:
writer.write(self._tag, 'B')
self._tag_pack_methods[self._tag](writer, self._data)
else:
raise ValueError('Cannot pack an empty MessageAudioClient.')
def clear(self):
self._tag = None
self._data = None
@classmethod
def typeByTag(cls, tag):
return cls._type_by_tag_value[tag]()
def __eq__(self, other):
if type(self) is type(other):
return self._tag == other._tag and self._data == other._data
else:
return NotImplemented
def __ne__(self, other):
if type(self) is type(other):
return not self.__eq__(other)
else:
return NotImplemented
def __len__(self):
if 0 <= self._tag < 7:
return self._tag_size_methods[self._tag](self._data)
else:
return 1
def __str__(self):
if 0 <= self._tag < 7:
return '{type}({name}={value})'.format(
type=type(self).__name__,
name=self.tag_name,
value=self._data)
else:
return '{type}()'.format(
type=type(self).__name__)
def __repr__(self):
if 0 <= self._tag < 7:
return '{type}({name}={value})'.format(
type=type(self).__name__,
name=self.tag_name,
value=repr(self._data))
else:
return '{type}()'.format(
type=type(self).__name__)
_tags_by_name = dict(
PostAudioEvent=0,
StopAllAudioEvents=1,
PostAudioGameState=2,
PostAudioSwitchState=3,
PostAudioParameter=4,
PostAudioMusicState=5,
AudioCallback=6,
)
_tags_by_value = dict()
_tags_by_value[0] = 'PostAudioEvent'
_tags_by_value[1] = 'StopAllAudioEvents'
_tags_by_value[2] = 'PostAudioGameState'
_tags_by_value[3] = 'PostAudioSwitchState'
_tags_by_value[4] = 'PostAudioParameter'
_tags_by_value[5] = 'PostAudioMusicState'
_tags_by_value[6] = 'AudioCallback'
_tag_unpack_methods = dict()
_tag_unpack_methods[0] = lambda reader: reader.read_object(Anki.AudioEngine.Multiplexer.PostAudioEvent.unpack_from)
_tag_unpack_methods[1] = lambda reader: reader.read_object(Anki.AudioEngine.Multiplexer.StopAllAudioEvents.unpack_from)
_tag_unpack_methods[2] = lambda reader: reader.read_object(Anki.AudioEngine.Multiplexer.PostAudioGameState.unpack_from)
_tag_unpack_methods[3] = lambda reader: reader.read_object(Anki.AudioEngine.Multiplexer.PostAudioSwitchState.unpack_from)
_tag_unpack_methods[4] = lambda reader: reader.read_object(Anki.AudioEngine.Multiplexer.PostAudioParameter.unpack_from)
_tag_unpack_methods[5] = lambda reader: reader.read_object(Anki.AudioEngine.Multiplexer.PostAudioMusicState.unpack_from)
_tag_unpack_methods[6] = lambda reader: reader.read_object(Anki.AudioEngine.Multiplexer.AudioCallback.unpack_from)
_tag_pack_methods = dict()
_tag_pack_methods[0] = lambda writer, value: writer.write_object(value)
_tag_pack_methods[1] = lambda writer, value: writer.write_object(value)
_tag_pack_methods[2] = lambda writer, value: writer.write_object(value)
_tag_pack_methods[3] = lambda writer, value: writer.write_object(value)
_tag_pack_methods[4] = lambda writer, value: writer.write_object(value)
_tag_pack_methods[5] = lambda writer, value: writer.write_object(value)
_tag_pack_methods[6] = lambda writer, value: writer.write_object(value)
_tag_size_methods = dict()
_tag_size_methods[0] = lambda value: msgbuffers.size_object(value)
_tag_size_methods[1] = lambda value: msgbuffers.size_object(value)
_tag_size_methods[2] = lambda value: msgbuffers.size_object(value)
_tag_size_methods[3] = lambda value: msgbuffers.size_object(value)
_tag_size_methods[4] = lambda value: msgbuffers.size_object(value)
_tag_size_methods[5] = lambda value: msgbuffers.size_object(value)
_tag_size_methods[6] = lambda value: msgbuffers.size_object(value)
_type_by_tag_value = dict()
_type_by_tag_value[0] = lambda : Anki.AudioEngine.Multiplexer.PostAudioEvent
_type_by_tag_value[1] = lambda : Anki.AudioEngine.Multiplexer.StopAllAudioEvents
_type_by_tag_value[2] = lambda : Anki.AudioEngine.Multiplexer.PostAudioGameState
_type_by_tag_value[3] = lambda : Anki.AudioEngine.Multiplexer.PostAudioSwitchState
_type_by_tag_value[4] = lambda : Anki.AudioEngine.Multiplexer.PostAudioParameter
_type_by_tag_value[5] = lambda : Anki.AudioEngine.Multiplexer.PostAudioMusicState
_type_by_tag_value[6] = lambda : Anki.AudioEngine.Multiplexer.AudioCallback
Anki.AudioEngine.Multiplexer.MessageAudioClient = MessageAudioClient
del MessageAudioClient
@@ -0,0 +1,14 @@
# Copyright (c) 2016-2017 Anki, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License in the file LICENSE.txt or at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
@@ -0,0 +1,36 @@
# Copyright (c) 2016-2017 Anki, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License in the file LICENSE.txt or at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""
Autogenerated python message buffer code.
Source: src/clad/externalInterface/messageEngineToGame.clad
Full command line: ../tools/message-buffers/emitters/ASTHash_emitter.py -I ../robot/clad/src/ ./src/ ../coretech/vision/clad/src/ ../coretech/common/clad/src/ ../lib/util/source/anki/clad -o ../generated/cladPython/clad/externalInterface/messageEngineToGame_hash.py ./src/clad/externalInterface/messageEngineToGame.clad
"""
from __future__ import absolute_import
from __future__ import print_function
def _modify_path():
import inspect, os, sys
search_paths = [
'.',
]
currentpath = os.path.abspath(os.path.dirname(inspect.getfile(inspect.currentframe())))
for search_path in search_paths:
search_path = os.path.normpath(os.path.abspath(os.path.realpath(os.path.join(currentpath, search_path))))
if search_path not in sys.path:
sys.path.insert(0, search_path)
_modify_path()
messageEngineToGameHash = 0xec981112010959c5e9a09b2c222fab52
@@ -0,0 +1,36 @@
# Copyright (c) 2016-2017 Anki, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License in the file LICENSE.txt or at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""
Autogenerated python message buffer code.
Source: src/clad/externalInterface/messageGameToEngine.clad
Full command line: ../tools/message-buffers/emitters/ASTHash_emitter.py -I ../robot/clad/src/ ./src/ ../coretech/vision/clad/src/ ../coretech/common/clad/src/ ../lib/util/source/anki/clad -o ../generated/cladPython/clad/externalInterface/messageGameToEngine_hash.py ./src/clad/externalInterface/messageGameToEngine.clad
"""
from __future__ import absolute_import
from __future__ import print_function
def _modify_path():
import inspect, os, sys
search_paths = [
'.',
]
currentpath = os.path.abspath(os.path.dirname(inspect.getfile(inspect.currentframe())))
for search_path in search_paths:
search_path = os.path.normpath(os.path.abspath(os.path.realpath(os.path.join(currentpath, search_path))))
if search_path not in sys.path:
sys.path.insert(0, search_path)
_modify_path()
messageGameToEngineHash = 0x235d0622461bf9f7e63f8189dd579c0c
@@ -0,0 +1,925 @@
# Copyright (c) 2016-2017 Anki, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License in the file LICENSE.txt or at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""
Autogenerated python message buffer code.
Source: clad/externalInterface/messageShared.clad
Full command line: ../tools/message-buffers/emitters/Python_emitter.py -C ./src/ -I ../robot/clad/src/ ../coretech/vision/clad/src/ ../coretech/common/clad/src/ ../lib/util/source/anki/clad -o ../generated/cladPython// clad/externalInterface/messageShared.clad
"""
from __future__ import absolute_import
from __future__ import print_function
def _modify_path():
import inspect, os, sys
search_paths = [
'../..',
'../../../../tools/message-buffers/support/python',
]
currentpath = os.path.abspath(os.path.dirname(inspect.getfile(inspect.currentframe())))
for search_path in search_paths:
search_path = os.path.normpath(os.path.abspath(os.path.realpath(os.path.join(currentpath, search_path))))
if search_path not in sys.path:
sys.path.insert(0, search_path)
_modify_path()
import msgbuffers
Anki = msgbuffers.Namespace()
Anki.AudioMetaData = msgbuffers.Namespace()
Anki.AudioMetaData.GameEvent = msgbuffers.Namespace()
Anki.Cozmo = msgbuffers.Namespace()
Anki.Cozmo.ExternalInterface = msgbuffers.Namespace()
from clad.types.actionTypes import Anki as _Anki
Anki.update(_Anki.deep_clone())
from clad.types.advertisementTypes import Anki as _Anki
Anki.update(_Anki.deep_clone())
class CommsConstants(object):
"Automatically-generated uint_32 enumeration."
kDirectCommsBufferSize = 1048576
kVizCommsBufferSize = 131072
Anki.Cozmo.ExternalInterface.CommsConstants = CommsConstants
class Ping(object):
"Generated message-passing message."
__slots__ = (
'_counter', # uint_32
'_timeSent_ms', # float_64
'_isResponse', # bool
)
@property
def counter(self):
"uint_32 counter struct property."
return self._counter
@counter.setter
def counter(self, value):
self._counter = msgbuffers.validate_integer(
'Ping.counter', value, 0, 4294967295)
@property
def timeSent_ms(self):
"float_64 timeSent_ms struct property."
return self._timeSent_ms
@timeSent_ms.setter
def timeSent_ms(self, value):
self._timeSent_ms = msgbuffers.validate_float(
'Ping.timeSent_ms', value, 'd')
@property
def isResponse(self):
"bool isResponse struct property."
return self._isResponse
@isResponse.setter
def isResponse(self, value):
self._isResponse = msgbuffers.validate_bool(
'Ping.isResponse', value)
def __init__(self, counter=0, timeSent_ms=0.0, isResponse=False):
self.counter = counter
self.timeSent_ms = timeSent_ms
self.isResponse = isResponse
@classmethod
def unpack(cls, buffer):
"Reads a new Ping from the given buffer."
reader = msgbuffers.BinaryReader(buffer)
value = cls.unpack_from(reader)
if reader.tell() != len(reader):
raise msgbuffers.ReadError(
('Ping.unpack received a buffer of length {length}, ' +
'but only {position} bytes were read.').format(
length=len(reader), position=reader.tell()))
return value
@classmethod
def unpack_from(cls, reader):
"Reads a new Ping from the given BinaryReader."
_counter = reader.read('I')
_timeSent_ms = reader.read('d')
_isResponse = bool(reader.read('b'))
return cls(_counter, _timeSent_ms, _isResponse)
def pack(self):
"Writes the current Ping, returning bytes."
writer = msgbuffers.BinaryWriter()
self.pack_to(writer)
return writer.dumps()
def pack_to(self, writer):
"Writes the current Ping to the given BinaryWriter."
writer.write(self._counter, 'I')
writer.write(self._timeSent_ms, 'd')
writer.write(int(self._isResponse), 'b')
def __eq__(self, other):
if type(self) is type(other):
return (self._counter == other._counter and
self._timeSent_ms == other._timeSent_ms and
self._isResponse == other._isResponse)
else:
return NotImplemented
def __ne__(self, other):
if type(self) is type(other):
return not self.__eq__(other)
else:
return NotImplemented
def __len__(self):
return (msgbuffers.size(self._counter, 'I') +
msgbuffers.size(self._timeSent_ms, 'd') +
msgbuffers.size(self._isResponse, 'b'))
def __str__(self):
return '{type}(counter={counter}, timeSent_ms={timeSent_ms}, isResponse={isResponse})'.format(
type=type(self).__name__,
counter=self._counter,
timeSent_ms=self._timeSent_ms,
isResponse=self._isResponse)
def __repr__(self):
return '{type}(counter={counter}, timeSent_ms={timeSent_ms}, isResponse={isResponse})'.format(
type=type(self).__name__,
counter=repr(self._counter),
timeSent_ms=repr(self._timeSent_ms),
isResponse=repr(self._isResponse))
Anki.Cozmo.ExternalInterface.Ping = Ping
del Ping
class DenyGameStart(object):
"Generated message-passing message."
__slots__ = ()
def __init__(self):
pass
@classmethod
def unpack(cls, buffer):
"Reads a new DenyGameStart from the given buffer."
reader = msgbuffers.BinaryReader(buffer)
value = cls.unpack_from(reader)
if reader.tell() != len(reader):
raise msgbuffers.ReadError(
('DenyGameStart.unpack received a buffer of length {length}, ' +
'but only {position} bytes were read.').format(
length=len(reader), position=reader.tell()))
return value
@classmethod
def unpack_from(cls, reader):
"Reads a new DenyGameStart from the given BinaryReader."
return cls()
def pack(self):
"Writes the current DenyGameStart, returning bytes."
writer = msgbuffers.BinaryWriter()
self.pack_to(writer)
return writer.dumps()
def pack_to(self, writer):
"Writes the current DenyGameStart to the given BinaryWriter."
def __eq__(self, other):
if type(self) is type(other):
return True
else:
return NotImplemented
def __ne__(self, other):
if type(self) is type(other):
return not self.__eq__(other)
else:
return NotImplemented
def __len__(self):
return 0
def __str__(self):
return '{type}()'.format(type=type(self).__name__)
def __repr__(self):
return '{type}()'.format(type=type(self).__name__)
Anki.Cozmo.ExternalInterface.DenyGameStart = DenyGameStart
del DenyGameStart
class DeviceAccelerometerValuesRaw(object):
"Generated message-passing message."
__slots__ = (
'_x_gForce', # float_32
'_y_gForce', # float_32
'_z_gForce', # float_32
)
@property
def x_gForce(self):
"float_32 x_gForce struct property."
return self._x_gForce
@x_gForce.setter
def x_gForce(self, value):
self._x_gForce = msgbuffers.validate_float(
'DeviceAccelerometerValuesRaw.x_gForce', value, 'f')
@property
def y_gForce(self):
"float_32 y_gForce struct property."
return self._y_gForce
@y_gForce.setter
def y_gForce(self, value):
self._y_gForce = msgbuffers.validate_float(
'DeviceAccelerometerValuesRaw.y_gForce', value, 'f')
@property
def z_gForce(self):
"float_32 z_gForce struct property."
return self._z_gForce
@z_gForce.setter
def z_gForce(self, value):
self._z_gForce = msgbuffers.validate_float(
'DeviceAccelerometerValuesRaw.z_gForce', value, 'f')
def __init__(self, x_gForce=0.0, y_gForce=0.0, z_gForce=0.0):
self.x_gForce = x_gForce
self.y_gForce = y_gForce
self.z_gForce = z_gForce
@classmethod
def unpack(cls, buffer):
"Reads a new DeviceAccelerometerValuesRaw from the given buffer."
reader = msgbuffers.BinaryReader(buffer)
value = cls.unpack_from(reader)
if reader.tell() != len(reader):
raise msgbuffers.ReadError(
('DeviceAccelerometerValuesRaw.unpack received a buffer of length {length}, ' +
'but only {position} bytes were read.').format(
length=len(reader), position=reader.tell()))
return value
@classmethod
def unpack_from(cls, reader):
"Reads a new DeviceAccelerometerValuesRaw from the given BinaryReader."
_x_gForce = reader.read('f')
_y_gForce = reader.read('f')
_z_gForce = reader.read('f')
return cls(_x_gForce, _y_gForce, _z_gForce)
def pack(self):
"Writes the current DeviceAccelerometerValuesRaw, returning bytes."
writer = msgbuffers.BinaryWriter()
self.pack_to(writer)
return writer.dumps()
def pack_to(self, writer):
"Writes the current DeviceAccelerometerValuesRaw to the given BinaryWriter."
writer.write(self._x_gForce, 'f')
writer.write(self._y_gForce, 'f')
writer.write(self._z_gForce, 'f')
def __eq__(self, other):
if type(self) is type(other):
return (self._x_gForce == other._x_gForce and
self._y_gForce == other._y_gForce and
self._z_gForce == other._z_gForce)
else:
return NotImplemented
def __ne__(self, other):
if type(self) is type(other):
return not self.__eq__(other)
else:
return NotImplemented
def __len__(self):
return (msgbuffers.size(self._x_gForce, 'f') +
msgbuffers.size(self._y_gForce, 'f') +
msgbuffers.size(self._z_gForce, 'f'))
def __str__(self):
return '{type}(x_gForce={x_gForce}, y_gForce={y_gForce}, z_gForce={z_gForce})'.format(
type=type(self).__name__,
x_gForce=self._x_gForce,
y_gForce=self._y_gForce,
z_gForce=self._z_gForce)
def __repr__(self):
return '{type}(x_gForce={x_gForce}, y_gForce={y_gForce}, z_gForce={z_gForce})'.format(
type=type(self).__name__,
x_gForce=repr(self._x_gForce),
y_gForce=repr(self._y_gForce),
z_gForce=repr(self._z_gForce))
Anki.Cozmo.ExternalInterface.DeviceAccelerometerValuesRaw = DeviceAccelerometerValuesRaw
del DeviceAccelerometerValuesRaw
class DeviceAccelerometerValuesUser(object):
"Generated message-passing message."
__slots__ = (
'_x_gForce', # float_32
'_y_gForce', # float_32
'_z_gForce', # float_32
)
@property
def x_gForce(self):
"float_32 x_gForce struct property."
return self._x_gForce
@x_gForce.setter
def x_gForce(self, value):
self._x_gForce = msgbuffers.validate_float(
'DeviceAccelerometerValuesUser.x_gForce', value, 'f')
@property
def y_gForce(self):
"float_32 y_gForce struct property."
return self._y_gForce
@y_gForce.setter
def y_gForce(self, value):
self._y_gForce = msgbuffers.validate_float(
'DeviceAccelerometerValuesUser.y_gForce', value, 'f')
@property
def z_gForce(self):
"float_32 z_gForce struct property."
return self._z_gForce
@z_gForce.setter
def z_gForce(self, value):
self._z_gForce = msgbuffers.validate_float(
'DeviceAccelerometerValuesUser.z_gForce', value, 'f')
def __init__(self, x_gForce=0.0, y_gForce=0.0, z_gForce=0.0):
self.x_gForce = x_gForce
self.y_gForce = y_gForce
self.z_gForce = z_gForce
@classmethod
def unpack(cls, buffer):
"Reads a new DeviceAccelerometerValuesUser from the given buffer."
reader = msgbuffers.BinaryReader(buffer)
value = cls.unpack_from(reader)
if reader.tell() != len(reader):
raise msgbuffers.ReadError(
('DeviceAccelerometerValuesUser.unpack received a buffer of length {length}, ' +
'but only {position} bytes were read.').format(
length=len(reader), position=reader.tell()))
return value
@classmethod
def unpack_from(cls, reader):
"Reads a new DeviceAccelerometerValuesUser from the given BinaryReader."
_x_gForce = reader.read('f')
_y_gForce = reader.read('f')
_z_gForce = reader.read('f')
return cls(_x_gForce, _y_gForce, _z_gForce)
def pack(self):
"Writes the current DeviceAccelerometerValuesUser, returning bytes."
writer = msgbuffers.BinaryWriter()
self.pack_to(writer)
return writer.dumps()
def pack_to(self, writer):
"Writes the current DeviceAccelerometerValuesUser to the given BinaryWriter."
writer.write(self._x_gForce, 'f')
writer.write(self._y_gForce, 'f')
writer.write(self._z_gForce, 'f')
def __eq__(self, other):
if type(self) is type(other):
return (self._x_gForce == other._x_gForce and
self._y_gForce == other._y_gForce and
self._z_gForce == other._z_gForce)
else:
return NotImplemented
def __ne__(self, other):
if type(self) is type(other):
return not self.__eq__(other)
else:
return NotImplemented
def __len__(self):
return (msgbuffers.size(self._x_gForce, 'f') +
msgbuffers.size(self._y_gForce, 'f') +
msgbuffers.size(self._z_gForce, 'f'))
def __str__(self):
return '{type}(x_gForce={x_gForce}, y_gForce={y_gForce}, z_gForce={z_gForce})'.format(
type=type(self).__name__,
x_gForce=self._x_gForce,
y_gForce=self._y_gForce,
z_gForce=self._z_gForce)
def __repr__(self):
return '{type}(x_gForce={x_gForce}, y_gForce={y_gForce}, z_gForce={z_gForce})'.format(
type=type(self).__name__,
x_gForce=repr(self._x_gForce),
y_gForce=repr(self._y_gForce),
z_gForce=repr(self._z_gForce))
Anki.Cozmo.ExternalInterface.DeviceAccelerometerValuesUser = DeviceAccelerometerValuesUser
del DeviceAccelerometerValuesUser
class DeviceGyroValues(object):
"Generated message-passing message."
__slots__ = (
'_w', # float_32
'_x', # float_32
'_y', # float_32
'_z', # float_32
)
@property
def w(self):
"float_32 w struct property."
return self._w
@w.setter
def w(self, value):
self._w = msgbuffers.validate_float(
'DeviceGyroValues.w', value, 'f')
@property
def x(self):
"float_32 x struct property."
return self._x
@x.setter
def x(self, value):
self._x = msgbuffers.validate_float(
'DeviceGyroValues.x', value, 'f')
@property
def y(self):
"float_32 y struct property."
return self._y
@y.setter
def y(self, value):
self._y = msgbuffers.validate_float(
'DeviceGyroValues.y', value, 'f')
@property
def z(self):
"float_32 z struct property."
return self._z
@z.setter
def z(self, value):
self._z = msgbuffers.validate_float(
'DeviceGyroValues.z', value, 'f')
def __init__(self, w=0.0, x=0.0, y=0.0, z=0.0):
self.w = w
self.x = x
self.y = y
self.z = z
@classmethod
def unpack(cls, buffer):
"Reads a new DeviceGyroValues from the given buffer."
reader = msgbuffers.BinaryReader(buffer)
value = cls.unpack_from(reader)
if reader.tell() != len(reader):
raise msgbuffers.ReadError(
('DeviceGyroValues.unpack received a buffer of length {length}, ' +
'but only {position} bytes were read.').format(
length=len(reader), position=reader.tell()))
return value
@classmethod
def unpack_from(cls, reader):
"Reads a new DeviceGyroValues from the given BinaryReader."
_w = reader.read('f')
_x = reader.read('f')
_y = reader.read('f')
_z = reader.read('f')
return cls(_w, _x, _y, _z)
def pack(self):
"Writes the current DeviceGyroValues, returning bytes."
writer = msgbuffers.BinaryWriter()
self.pack_to(writer)
return writer.dumps()
def pack_to(self, writer):
"Writes the current DeviceGyroValues to the given BinaryWriter."
writer.write(self._w, 'f')
writer.write(self._x, 'f')
writer.write(self._y, 'f')
writer.write(self._z, 'f')
def __eq__(self, other):
if type(self) is type(other):
return (self._w == other._w and
self._x == other._x and
self._y == other._y and
self._z == other._z)
else:
return NotImplemented
def __ne__(self, other):
if type(self) is type(other):
return not self.__eq__(other)
else:
return NotImplemented
def __len__(self):
return (msgbuffers.size(self._w, 'f') +
msgbuffers.size(self._x, 'f') +
msgbuffers.size(self._y, 'f') +
msgbuffers.size(self._z, 'f'))
def __str__(self):
return '{type}(w={w}, x={x}, y={y}, z={z})'.format(
type=type(self).__name__,
w=self._w,
x=self._x,
y=self._y,
z=self._z)
def __repr__(self):
return '{type}(w={w}, x={x}, y={y}, z={z})'.format(
type=type(self).__name__,
w=repr(self._w),
x=repr(self._x),
y=repr(self._y),
z=repr(self._z))
Anki.Cozmo.ExternalInterface.DeviceGyroValues = DeviceGyroValues
del DeviceGyroValues
class EnableDeviceIMUData(object):
"Generated message-passing message."
__slots__ = (
'_enableAccelerometerRaw', # bool
'_enableAccelerometerUser', # bool
'_enableGyro', # bool
)
@property
def enableAccelerometerRaw(self):
"bool enableAccelerometerRaw struct property."
return self._enableAccelerometerRaw
@enableAccelerometerRaw.setter
def enableAccelerometerRaw(self, value):
self._enableAccelerometerRaw = msgbuffers.validate_bool(
'EnableDeviceIMUData.enableAccelerometerRaw', value)
@property
def enableAccelerometerUser(self):
"bool enableAccelerometerUser struct property."
return self._enableAccelerometerUser
@enableAccelerometerUser.setter
def enableAccelerometerUser(self, value):
self._enableAccelerometerUser = msgbuffers.validate_bool(
'EnableDeviceIMUData.enableAccelerometerUser', value)
@property
def enableGyro(self):
"bool enableGyro struct property."
return self._enableGyro
@enableGyro.setter
def enableGyro(self, value):
self._enableGyro = msgbuffers.validate_bool(
'EnableDeviceIMUData.enableGyro', value)
def __init__(self, enableAccelerometerRaw=False, enableAccelerometerUser=False, enableGyro=False):
self.enableAccelerometerRaw = enableAccelerometerRaw
self.enableAccelerometerUser = enableAccelerometerUser
self.enableGyro = enableGyro
@classmethod
def unpack(cls, buffer):
"Reads a new EnableDeviceIMUData from the given buffer."
reader = msgbuffers.BinaryReader(buffer)
value = cls.unpack_from(reader)
if reader.tell() != len(reader):
raise msgbuffers.ReadError(
('EnableDeviceIMUData.unpack received a buffer of length {length}, ' +
'but only {position} bytes were read.').format(
length=len(reader), position=reader.tell()))
return value
@classmethod
def unpack_from(cls, reader):
"Reads a new EnableDeviceIMUData from the given BinaryReader."
_enableAccelerometerRaw = bool(reader.read('b'))
_enableAccelerometerUser = bool(reader.read('b'))
_enableGyro = bool(reader.read('b'))
return cls(_enableAccelerometerRaw, _enableAccelerometerUser, _enableGyro)
def pack(self):
"Writes the current EnableDeviceIMUData, returning bytes."
writer = msgbuffers.BinaryWriter()
self.pack_to(writer)
return writer.dumps()
def pack_to(self, writer):
"Writes the current EnableDeviceIMUData to the given BinaryWriter."
writer.write(int(self._enableAccelerometerRaw), 'b')
writer.write(int(self._enableAccelerometerUser), 'b')
writer.write(int(self._enableGyro), 'b')
def __eq__(self, other):
if type(self) is type(other):
return (self._enableAccelerometerRaw == other._enableAccelerometerRaw and
self._enableAccelerometerUser == other._enableAccelerometerUser and
self._enableGyro == other._enableGyro)
else:
return NotImplemented
def __ne__(self, other):
if type(self) is type(other):
return not self.__eq__(other)
else:
return NotImplemented
def __len__(self):
return (msgbuffers.size(self._enableAccelerometerRaw, 'b') +
msgbuffers.size(self._enableAccelerometerUser, 'b') +
msgbuffers.size(self._enableGyro, 'b'))
def __str__(self):
return '{type}(enableAccelerometerRaw={enableAccelerometerRaw}, enableAccelerometerUser={enableAccelerometerUser}, enableGyro={enableGyro})'.format(
type=type(self).__name__,
enableAccelerometerRaw=self._enableAccelerometerRaw,
enableAccelerometerUser=self._enableAccelerometerUser,
enableGyro=self._enableGyro)
def __repr__(self):
return '{type}(enableAccelerometerRaw={enableAccelerometerRaw}, enableAccelerometerUser={enableAccelerometerUser}, enableGyro={enableGyro})'.format(
type=type(self).__name__,
enableAccelerometerRaw=repr(self._enableAccelerometerRaw),
enableAccelerometerUser=repr(self._enableAccelerometerUser),
enableGyro=repr(self._enableGyro))
Anki.Cozmo.ExternalInterface.EnableDeviceIMUData = EnableDeviceIMUData
del EnableDeviceIMUData
class IsDeviceIMUSupported(object):
"Generated message-passing message."
__slots__ = (
'_isAccelerometerSupported', # bool
'_isGyroSupported', # bool
)
@property
def isAccelerometerSupported(self):
"bool isAccelerometerSupported struct property."
return self._isAccelerometerSupported
@isAccelerometerSupported.setter
def isAccelerometerSupported(self, value):
self._isAccelerometerSupported = msgbuffers.validate_bool(
'IsDeviceIMUSupported.isAccelerometerSupported', value)
@property
def isGyroSupported(self):
"bool isGyroSupported struct property."
return self._isGyroSupported
@isGyroSupported.setter
def isGyroSupported(self, value):
self._isGyroSupported = msgbuffers.validate_bool(
'IsDeviceIMUSupported.isGyroSupported', value)
def __init__(self, isAccelerometerSupported=False, isGyroSupported=False):
self.isAccelerometerSupported = isAccelerometerSupported
self.isGyroSupported = isGyroSupported
@classmethod
def unpack(cls, buffer):
"Reads a new IsDeviceIMUSupported from the given buffer."
reader = msgbuffers.BinaryReader(buffer)
value = cls.unpack_from(reader)
if reader.tell() != len(reader):
raise msgbuffers.ReadError(
('IsDeviceIMUSupported.unpack received a buffer of length {length}, ' +
'but only {position} bytes were read.').format(
length=len(reader), position=reader.tell()))
return value
@classmethod
def unpack_from(cls, reader):
"Reads a new IsDeviceIMUSupported from the given BinaryReader."
_isAccelerometerSupported = bool(reader.read('b'))
_isGyroSupported = bool(reader.read('b'))
return cls(_isAccelerometerSupported, _isGyroSupported)
def pack(self):
"Writes the current IsDeviceIMUSupported, returning bytes."
writer = msgbuffers.BinaryWriter()
self.pack_to(writer)
return writer.dumps()
def pack_to(self, writer):
"Writes the current IsDeviceIMUSupported to the given BinaryWriter."
writer.write(int(self._isAccelerometerSupported), 'b')
writer.write(int(self._isGyroSupported), 'b')
def __eq__(self, other):
if type(self) is type(other):
return (self._isAccelerometerSupported == other._isAccelerometerSupported and
self._isGyroSupported == other._isGyroSupported)
else:
return NotImplemented
def __ne__(self, other):
if type(self) is type(other):
return not self.__eq__(other)
else:
return NotImplemented
def __len__(self):
return (msgbuffers.size(self._isAccelerometerSupported, 'b') +
msgbuffers.size(self._isGyroSupported, 'b'))
def __str__(self):
return '{type}(isAccelerometerSupported={isAccelerometerSupported}, isGyroSupported={isGyroSupported})'.format(
type=type(self).__name__,
isAccelerometerSupported=self._isAccelerometerSupported,
isGyroSupported=self._isGyroSupported)
def __repr__(self):
return '{type}(isAccelerometerSupported={isAccelerometerSupported}, isGyroSupported={isGyroSupported})'.format(
type=type(self).__name__,
isAccelerometerSupported=repr(self._isAccelerometerSupported),
isGyroSupported=repr(self._isGyroSupported))
Anki.Cozmo.ExternalInterface.IsDeviceIMUSupported = IsDeviceIMUSupported
del IsDeviceIMUSupported
class GameToGame(object):
"Generated message-passing message."
__slots__ = (
'_messagePartIndex', # uint_8
'_messagePartCount', # uint_8
'_messageType', # string[uint_8]
'_payload', # string[uint_16]
)
@property
def messagePartIndex(self):
"uint_8 messagePartIndex struct property."
return self._messagePartIndex
@messagePartIndex.setter
def messagePartIndex(self, value):
self._messagePartIndex = msgbuffers.validate_integer(
'GameToGame.messagePartIndex', value, 0, 255)
@property
def messagePartCount(self):
"uint_8 messagePartCount struct property."
return self._messagePartCount
@messagePartCount.setter
def messagePartCount(self, value):
self._messagePartCount = msgbuffers.validate_integer(
'GameToGame.messagePartCount', value, 0, 255)
@property
def messageType(self):
"string[uint_8] messageType struct property."
return self._messageType
@messageType.setter
def messageType(self, value):
self._messageType = msgbuffers.validate_string(
'GameToGame.messageType', value, 255)
@property
def payload(self):
"string[uint_16] payload struct property."
return self._payload
@payload.setter
def payload(self, value):
self._payload = msgbuffers.validate_string(
'GameToGame.payload', value, 65535)
def __init__(self, messagePartIndex=0, messagePartCount=0, messageType='', payload=''):
self.messagePartIndex = messagePartIndex
self.messagePartCount = messagePartCount
self.messageType = messageType
self.payload = payload
@classmethod
def unpack(cls, buffer):
"Reads a new GameToGame from the given buffer."
reader = msgbuffers.BinaryReader(buffer)
value = cls.unpack_from(reader)
if reader.tell() != len(reader):
raise msgbuffers.ReadError(
('GameToGame.unpack received a buffer of length {length}, ' +
'but only {position} bytes were read.').format(
length=len(reader), position=reader.tell()))
return value
@classmethod
def unpack_from(cls, reader):
"Reads a new GameToGame from the given BinaryReader."
_messagePartIndex = reader.read('B')
_messagePartCount = reader.read('B')
_messageType = reader.read_string('B')
_payload = reader.read_string('H')
return cls(_messagePartIndex, _messagePartCount, _messageType, _payload)
def pack(self):
"Writes the current GameToGame, returning bytes."
writer = msgbuffers.BinaryWriter()
self.pack_to(writer)
return writer.dumps()
def pack_to(self, writer):
"Writes the current GameToGame to the given BinaryWriter."
writer.write(self._messagePartIndex, 'B')
writer.write(self._messagePartCount, 'B')
writer.write_string(self._messageType, 'B')
writer.write_string(self._payload, 'H')
def __eq__(self, other):
if type(self) is type(other):
return (self._messagePartIndex == other._messagePartIndex and
self._messagePartCount == other._messagePartCount and
self._messageType == other._messageType and
self._payload == other._payload)
else:
return NotImplemented
def __ne__(self, other):
if type(self) is type(other):
return not self.__eq__(other)
else:
return NotImplemented
def __len__(self):
return (msgbuffers.size(self._messagePartIndex, 'B') +
msgbuffers.size(self._messagePartCount, 'B') +
msgbuffers.size_string(self._messageType, 'B') +
msgbuffers.size_string(self._payload, 'H'))
def __str__(self):
return '{type}(messagePartIndex={messagePartIndex}, messagePartCount={messagePartCount}, messageType={messageType}, payload={payload})'.format(
type=type(self).__name__,
messagePartIndex=self._messagePartIndex,
messagePartCount=self._messagePartCount,
messageType=msgbuffers.shorten_string(self._messageType),
payload=msgbuffers.shorten_string(self._payload))
def __repr__(self):
return '{type}(messagePartIndex={messagePartIndex}, messagePartCount={messagePartCount}, messageType={messageType}, payload={payload})'.format(
type=type(self).__name__,
messagePartIndex=repr(self._messagePartIndex),
messagePartCount=repr(self._messagePartCount),
messageType=repr(self._messageType),
payload=repr(self._payload))
Anki.Cozmo.ExternalInterface.GameToGame = GameToGame
del GameToGame
@@ -0,0 +1,551 @@
# Copyright (c) 2016-2017 Anki, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License in the file LICENSE.txt or at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""
Autogenerated python message buffer code.
Source: clad/externalInterface/messageToBehaviorManager.clad
Full command line: ../tools/message-buffers/emitters/Python_emitter.py -C ./src/ -I ../robot/clad/src/ ../coretech/vision/clad/src/ ../coretech/common/clad/src/ ../lib/util/source/anki/clad -o ../generated/cladPython// clad/externalInterface/messageToBehaviorManager.clad
"""
from __future__ import absolute_import
from __future__ import print_function
def _modify_path():
import inspect, os, sys
search_paths = [
'../..',
'../../../../tools/message-buffers/support/python',
]
currentpath = os.path.abspath(os.path.dirname(inspect.getfile(inspect.currentframe())))
for search_path in search_paths:
search_path = os.path.normpath(os.path.abspath(os.path.realpath(os.path.join(currentpath, search_path))))
if search_path not in sys.path:
sys.path.insert(0, search_path)
_modify_path()
import msgbuffers
Anki = msgbuffers.Namespace()
Anki.AudioMetaData = msgbuffers.Namespace()
Anki.AudioMetaData.GameState = msgbuffers.Namespace()
Anki.AudioMetaData.SwitchState = msgbuffers.Namespace()
Anki.Cozmo = msgbuffers.Namespace()
Anki.Cozmo.ExternalInterface = msgbuffers.Namespace()
from clad.audio.audioStateTypes import Anki as _Anki
Anki.update(_Anki.deep_clone())
from clad.audio.audioSwitchTypes import Anki as _Anki
Anki.update(_Anki.deep_clone())
from clad.types.behaviorSystem.behaviorTypes import Anki as _Anki
Anki.update(_Anki.deep_clone())
from clad.types.unlockTypes import Anki as _Anki
Anki.update(_Anki.deep_clone())
class ActivateSpark(object):
"Generated message-passing structure."
__slots__ = (
'_behaviorSpark', # Anki.Cozmo.UnlockId
)
@property
def behaviorSpark(self):
"Anki.Cozmo.UnlockId behaviorSpark struct property."
return self._behaviorSpark
@behaviorSpark.setter
def behaviorSpark(self, value):
self._behaviorSpark = msgbuffers.validate_integer(
'ActivateSpark.behaviorSpark', value, -2147483648, 2147483647)
def __init__(self, behaviorSpark=Anki.Cozmo.UnlockId.Invalid):
self.behaviorSpark = behaviorSpark
@classmethod
def unpack(cls, buffer):
"Reads a new ActivateSpark from the given buffer."
reader = msgbuffers.BinaryReader(buffer)
value = cls.unpack_from(reader)
if reader.tell() != len(reader):
raise msgbuffers.ReadError(
('ActivateSpark.unpack received a buffer of length {length}, ' +
'but only {position} bytes were read.').format(
length=len(reader), position=reader.tell()))
return value
@classmethod
def unpack_from(cls, reader):
"Reads a new ActivateSpark from the given BinaryReader."
_behaviorSpark = reader.read('i')
return cls(_behaviorSpark)
def pack(self):
"Writes the current ActivateSpark, returning bytes."
writer = msgbuffers.BinaryWriter()
self.pack_to(writer)
return writer.dumps()
def pack_to(self, writer):
"Writes the current ActivateSpark to the given BinaryWriter."
writer.write(self._behaviorSpark, 'i')
def __eq__(self, other):
if type(self) is type(other):
return self._behaviorSpark == other._behaviorSpark
else:
return NotImplemented
def __ne__(self, other):
if type(self) is type(other):
return not self.__eq__(other)
else:
return NotImplemented
def __len__(self):
return (msgbuffers.size(self._behaviorSpark, 'i'))
def __str__(self):
return '{type}(behaviorSpark={behaviorSpark})'.format(
type=type(self).__name__,
behaviorSpark=self._behaviorSpark)
def __repr__(self):
return '{type}(behaviorSpark={behaviorSpark})'.format(
type=type(self).__name__,
behaviorSpark=repr(self._behaviorSpark))
Anki.Cozmo.ExternalInterface.ActivateSpark = ActivateSpark
del ActivateSpark
class SparkUnlocked(object):
"Generated message-passing structure."
__slots__ = (
'_behaviorSpark', # Anki.Cozmo.UnlockId
)
@property
def behaviorSpark(self):
"Anki.Cozmo.UnlockId behaviorSpark struct property."
return self._behaviorSpark
@behaviorSpark.setter
def behaviorSpark(self, value):
self._behaviorSpark = msgbuffers.validate_integer(
'SparkUnlocked.behaviorSpark', value, -2147483648, 2147483647)
def __init__(self, behaviorSpark=Anki.Cozmo.UnlockId.Invalid):
self.behaviorSpark = behaviorSpark
@classmethod
def unpack(cls, buffer):
"Reads a new SparkUnlocked from the given buffer."
reader = msgbuffers.BinaryReader(buffer)
value = cls.unpack_from(reader)
if reader.tell() != len(reader):
raise msgbuffers.ReadError(
('SparkUnlocked.unpack received a buffer of length {length}, ' +
'but only {position} bytes were read.').format(
length=len(reader), position=reader.tell()))
return value
@classmethod
def unpack_from(cls, reader):
"Reads a new SparkUnlocked from the given BinaryReader."
_behaviorSpark = reader.read('i')
return cls(_behaviorSpark)
def pack(self):
"Writes the current SparkUnlocked, returning bytes."
writer = msgbuffers.BinaryWriter()
self.pack_to(writer)
return writer.dumps()
def pack_to(self, writer):
"Writes the current SparkUnlocked to the given BinaryWriter."
writer.write(self._behaviorSpark, 'i')
def __eq__(self, other):
if type(self) is type(other):
return self._behaviorSpark == other._behaviorSpark
else:
return NotImplemented
def __ne__(self, other):
if type(self) is type(other):
return not self.__eq__(other)
else:
return NotImplemented
def __len__(self):
return (msgbuffers.size(self._behaviorSpark, 'i'))
def __str__(self):
return '{type}(behaviorSpark={behaviorSpark})'.format(
type=type(self).__name__,
behaviorSpark=self._behaviorSpark)
def __repr__(self):
return '{type}(behaviorSpark={behaviorSpark})'.format(
type=type(self).__name__,
behaviorSpark=repr(self._behaviorSpark))
Anki.Cozmo.ExternalInterface.SparkUnlocked = SparkUnlocked
del SparkUnlocked
class DoATrickRequest(object):
"Generated message-passing structure."
__slots__ = ()
def __init__(self):
pass
@classmethod
def unpack(cls, buffer):
"Reads a new DoATrickRequest from the given buffer."
reader = msgbuffers.BinaryReader(buffer)
value = cls.unpack_from(reader)
if reader.tell() != len(reader):
raise msgbuffers.ReadError(
('DoATrickRequest.unpack received a buffer of length {length}, ' +
'but only {position} bytes were read.').format(
length=len(reader), position=reader.tell()))
return value
@classmethod
def unpack_from(cls, reader):
"Reads a new DoATrickRequest from the given BinaryReader."
return cls()
def pack(self):
"Writes the current DoATrickRequest, returning bytes."
writer = msgbuffers.BinaryWriter()
self.pack_to(writer)
return writer.dumps()
def pack_to(self, writer):
"Writes the current DoATrickRequest to the given BinaryWriter."
def __eq__(self, other):
if type(self) is type(other):
return True
else:
return NotImplemented
def __ne__(self, other):
if type(self) is type(other):
return not self.__eq__(other)
else:
return NotImplemented
def __len__(self):
return 0
def __str__(self):
return '{type}()'.format(type=type(self).__name__)
def __repr__(self):
return '{type}()'.format(type=type(self).__name__)
Anki.Cozmo.ExternalInterface.DoATrickRequest = DoATrickRequest
del DoATrickRequest
class PlayAGameRequest(object):
"Generated message-passing structure."
__slots__ = ()
def __init__(self):
pass
@classmethod
def unpack(cls, buffer):
"Reads a new PlayAGameRequest from the given buffer."
reader = msgbuffers.BinaryReader(buffer)
value = cls.unpack_from(reader)
if reader.tell() != len(reader):
raise msgbuffers.ReadError(
('PlayAGameRequest.unpack received a buffer of length {length}, ' +
'but only {position} bytes were read.').format(
length=len(reader), position=reader.tell()))
return value
@classmethod
def unpack_from(cls, reader):
"Reads a new PlayAGameRequest from the given BinaryReader."
return cls()
def pack(self):
"Writes the current PlayAGameRequest, returning bytes."
writer = msgbuffers.BinaryWriter()
self.pack_to(writer)
return writer.dumps()
def pack_to(self, writer):
"Writes the current PlayAGameRequest to the given BinaryWriter."
def __eq__(self, other):
if type(self) is type(other):
return True
else:
return NotImplemented
def __ne__(self, other):
if type(self) is type(other):
return not self.__eq__(other)
else:
return NotImplemented
def __len__(self):
return 0
def __str__(self):
return '{type}()'.format(type=type(self).__name__)
def __repr__(self):
return '{type}()'.format(type=type(self).__name__)
Anki.Cozmo.ExternalInterface.PlayAGameRequest = PlayAGameRequest
del PlayAGameRequest
class BehaviorManagerMessageUnion(object):
"Generated message-passing union."
__slots__ = ('_tag', '_data')
class Tag(object):
"The type indicator for this union."
ActivateSpark = 0 # Anki.Cozmo.ExternalInterface.ActivateSpark
SparkUnlocked = 1 # Anki.Cozmo.ExternalInterface.SparkUnlocked
DoATrickRequest = 2 # Anki.Cozmo.ExternalInterface.DoATrickRequest
PlayAGameRequest = 3 # Anki.Cozmo.ExternalInterface.PlayAGameRequest
@property
def tag(self):
"The current tag for this union."
return self._tag
@property
def tag_name(self):
"The name of the current tag for this union."
if self._tag in self._tags_by_value:
return self._tags_by_value[self._tag]
else:
return None
@property
def data(self):
"The data held by this union. None if no data is set."
return self._data
@property
def ActivateSpark(self):
"Anki.Cozmo.ExternalInterface.ActivateSpark ActivateSpark union property."
msgbuffers.safety_check_tag('ActivateSpark', self._tag, self.Tag.ActivateSpark, self._tags_by_value)
return self._data
@ActivateSpark.setter
def ActivateSpark(self, value):
self._data = msgbuffers.validate_object(
'BehaviorManagerMessageUnion.ActivateSpark', value, Anki.Cozmo.ExternalInterface.ActivateSpark)
self._tag = self.Tag.ActivateSpark
@property
def SparkUnlocked(self):
"Anki.Cozmo.ExternalInterface.SparkUnlocked SparkUnlocked union property."
msgbuffers.safety_check_tag('SparkUnlocked', self._tag, self.Tag.SparkUnlocked, self._tags_by_value)
return self._data
@SparkUnlocked.setter
def SparkUnlocked(self, value):
self._data = msgbuffers.validate_object(
'BehaviorManagerMessageUnion.SparkUnlocked', value, Anki.Cozmo.ExternalInterface.SparkUnlocked)
self._tag = self.Tag.SparkUnlocked
@property
def DoATrickRequest(self):
"Anki.Cozmo.ExternalInterface.DoATrickRequest DoATrickRequest union property."
msgbuffers.safety_check_tag('DoATrickRequest', self._tag, self.Tag.DoATrickRequest, self._tags_by_value)
return self._data
@DoATrickRequest.setter
def DoATrickRequest(self, value):
self._data = msgbuffers.validate_object(
'BehaviorManagerMessageUnion.DoATrickRequest', value, Anki.Cozmo.ExternalInterface.DoATrickRequest)
self._tag = self.Tag.DoATrickRequest
@property
def PlayAGameRequest(self):
"Anki.Cozmo.ExternalInterface.PlayAGameRequest PlayAGameRequest union property."
msgbuffers.safety_check_tag('PlayAGameRequest', self._tag, self.Tag.PlayAGameRequest, self._tags_by_value)
return self._data
@PlayAGameRequest.setter
def PlayAGameRequest(self, value):
self._data = msgbuffers.validate_object(
'BehaviorManagerMessageUnion.PlayAGameRequest', value, Anki.Cozmo.ExternalInterface.PlayAGameRequest)
self._tag = self.Tag.PlayAGameRequest
def __init__(self, **kwargs):
if not kwargs:
self._tag = None
self._data = None
elif len(kwargs) == 1:
key, value = next(iter(kwargs.items()))
if key not in self._tags_by_name:
raise TypeError("'{argument}' is an invalid keyword argument for this method.".format(argument=key))
# calls the correct property
setattr(self, key, value)
else:
raise TypeError('This method only accepts up to one keyword argument.')
@classmethod
def unpack(cls, buffer):
"Reads a new BehaviorManagerMessageUnion from the given buffer."
reader = msgbuffers.BinaryReader(buffer)
value = cls.unpack_from(reader)
if reader.tell() != len(reader):
raise msgbuffers.ReadError(
('BehaviorManagerMessageUnion.unpack received a buffer of length {length}, ' +
'but only {position} bytes were read.').format(
length=len(reader), position=reader.tell()))
return value
@classmethod
def unpack_from(cls, reader):
"Reads a new BehaviorManagerMessageUnion from the given BinaryReader."
tag = reader.read('B')
if tag in cls._tags_by_value:
value = cls()
setattr(value, cls._tags_by_value[tag], cls._tag_unpack_methods[tag](reader))
return value
else:
raise ValueError('BehaviorManagerMessageUnion attempted to unpack unknown tag {tag}.'.format(tag=tag))
def pack(self):
"Writes the current BehaviorManagerMessageUnion, returning bytes."
writer = msgbuffers.BinaryWriter()
self.pack_to(writer)
return writer.dumps()
def pack_to(self, writer):
"Writes the current SampleUnion to the given BinaryWriter."
if self._tag in self._tags_by_value:
writer.write(self._tag, 'B')
self._tag_pack_methods[self._tag](writer, self._data)
else:
raise ValueError('Cannot pack an empty BehaviorManagerMessageUnion.')
def clear(self):
self._tag = None
self._data = None
@classmethod
def typeByTag(cls, tag):
return cls._type_by_tag_value[tag]()
def __eq__(self, other):
if type(self) is type(other):
return self._tag == other._tag and self._data == other._data
else:
return NotImplemented
def __ne__(self, other):
if type(self) is type(other):
return not self.__eq__(other)
else:
return NotImplemented
def __len__(self):
if 0 <= self._tag < 4:
return self._tag_size_methods[self._tag](self._data)
else:
return 1
def __str__(self):
if 0 <= self._tag < 4:
return '{type}({name}={value})'.format(
type=type(self).__name__,
name=self.tag_name,
value=self._data)
else:
return '{type}()'.format(
type=type(self).__name__)
def __repr__(self):
if 0 <= self._tag < 4:
return '{type}({name}={value})'.format(
type=type(self).__name__,
name=self.tag_name,
value=repr(self._data))
else:
return '{type}()'.format(
type=type(self).__name__)
_tags_by_name = dict(
ActivateSpark=0,
SparkUnlocked=1,
DoATrickRequest=2,
PlayAGameRequest=3,
)
_tags_by_value = dict()
_tags_by_value[0] = 'ActivateSpark'
_tags_by_value[1] = 'SparkUnlocked'
_tags_by_value[2] = 'DoATrickRequest'
_tags_by_value[3] = 'PlayAGameRequest'
_tag_unpack_methods = dict()
_tag_unpack_methods[0] = lambda reader: reader.read_object(Anki.Cozmo.ExternalInterface.ActivateSpark.unpack_from)
_tag_unpack_methods[1] = lambda reader: reader.read_object(Anki.Cozmo.ExternalInterface.SparkUnlocked.unpack_from)
_tag_unpack_methods[2] = lambda reader: reader.read_object(Anki.Cozmo.ExternalInterface.DoATrickRequest.unpack_from)
_tag_unpack_methods[3] = lambda reader: reader.read_object(Anki.Cozmo.ExternalInterface.PlayAGameRequest.unpack_from)
_tag_pack_methods = dict()
_tag_pack_methods[0] = lambda writer, value: writer.write_object(value)
_tag_pack_methods[1] = lambda writer, value: writer.write_object(value)
_tag_pack_methods[2] = lambda writer, value: writer.write_object(value)
_tag_pack_methods[3] = lambda writer, value: writer.write_object(value)
_tag_size_methods = dict()
_tag_size_methods[0] = lambda value: msgbuffers.size_object(value)
_tag_size_methods[1] = lambda value: msgbuffers.size_object(value)
_tag_size_methods[2] = lambda value: msgbuffers.size_object(value)
_tag_size_methods[3] = lambda value: msgbuffers.size_object(value)
_type_by_tag_value = dict()
_type_by_tag_value[0] = lambda : Anki.Cozmo.ExternalInterface.ActivateSpark
_type_by_tag_value[1] = lambda : Anki.Cozmo.ExternalInterface.SparkUnlocked
_type_by_tag_value[2] = lambda : Anki.Cozmo.ExternalInterface.DoATrickRequest
_type_by_tag_value[3] = lambda : Anki.Cozmo.ExternalInterface.PlayAGameRequest
Anki.Cozmo.ExternalInterface.BehaviorManagerMessageUnion = BehaviorManagerMessageUnion
del BehaviorManagerMessageUnion
@@ -0,0 +1,14 @@
# Copyright (c) 2016-2017 Anki, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License in the file LICENSE.txt or at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
@@ -0,0 +1,338 @@
# Copyright (c) 2016-2017 Anki, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License in the file LICENSE.txt or at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""
Autogenerated python message buffer code.
Source: clad/physicsInterface/messageSimPhysics.clad
Full command line: ../tools/message-buffers/emitters/Python_emitter.py -C ./vizSrc/ -I ../robot/clad/src/ ./src/ -o ../generated/cladPython// clad/physicsInterface/messageSimPhysics.clad
"""
from __future__ import absolute_import
from __future__ import print_function
def _modify_path():
import inspect, os, sys
search_paths = [
'../..',
'../../../../tools/message-buffers/support/python',
]
currentpath = os.path.abspath(os.path.dirname(inspect.getfile(inspect.currentframe())))
for search_path in search_paths:
search_path = os.path.normpath(os.path.abspath(os.path.realpath(os.path.join(currentpath, search_path))))
if search_path not in sys.path:
sys.path.insert(0, search_path)
_modify_path()
import msgbuffers
Anki = msgbuffers.Namespace()
Anki.Cozmo = msgbuffers.Namespace()
Anki.Cozmo.PhysicsInterface = msgbuffers.Namespace()
class ApplyForce(object):
"Generated message-passing message."
__slots__ = (
'_xForce', # float_32
'_yForce', # float_32
'_zForce', # float_32
'_DefName', # string[uint_8]
)
@property
def xForce(self):
"float_32 xForce struct property."
return self._xForce
@xForce.setter
def xForce(self, value):
self._xForce = msgbuffers.validate_float(
'ApplyForce.xForce', value, 'f')
@property
def yForce(self):
"float_32 yForce struct property."
return self._yForce
@yForce.setter
def yForce(self, value):
self._yForce = msgbuffers.validate_float(
'ApplyForce.yForce', value, 'f')
@property
def zForce(self):
"float_32 zForce struct property."
return self._zForce
@zForce.setter
def zForce(self, value):
self._zForce = msgbuffers.validate_float(
'ApplyForce.zForce', value, 'f')
@property
def DefName(self):
"string[uint_8] DefName struct property."
return self._DefName
@DefName.setter
def DefName(self, value):
self._DefName = msgbuffers.validate_string(
'ApplyForce.DefName', value, 255)
def __init__(self, xForce=0.0, yForce=0.0, zForce=0.0, DefName=''):
self.xForce = xForce
self.yForce = yForce
self.zForce = zForce
self.DefName = DefName
@classmethod
def unpack(cls, buffer):
"Reads a new ApplyForce from the given buffer."
reader = msgbuffers.BinaryReader(buffer)
value = cls.unpack_from(reader)
if reader.tell() != len(reader):
raise msgbuffers.ReadError(
('ApplyForce.unpack received a buffer of length {length}, ' +
'but only {position} bytes were read.').format(
length=len(reader), position=reader.tell()))
return value
@classmethod
def unpack_from(cls, reader):
"Reads a new ApplyForce from the given BinaryReader."
_xForce = reader.read('f')
_yForce = reader.read('f')
_zForce = reader.read('f')
_DefName = reader.read_string('B')
return cls(_xForce, _yForce, _zForce, _DefName)
def pack(self):
"Writes the current ApplyForce, returning bytes."
writer = msgbuffers.BinaryWriter()
self.pack_to(writer)
return writer.dumps()
def pack_to(self, writer):
"Writes the current ApplyForce to the given BinaryWriter."
writer.write(self._xForce, 'f')
writer.write(self._yForce, 'f')
writer.write(self._zForce, 'f')
writer.write_string(self._DefName, 'B')
def __eq__(self, other):
if type(self) is type(other):
return (self._xForce == other._xForce and
self._yForce == other._yForce and
self._zForce == other._zForce and
self._DefName == other._DefName)
else:
return NotImplemented
def __ne__(self, other):
if type(self) is type(other):
return not self.__eq__(other)
else:
return NotImplemented
def __len__(self):
return (msgbuffers.size(self._xForce, 'f') +
msgbuffers.size(self._yForce, 'f') +
msgbuffers.size(self._zForce, 'f') +
msgbuffers.size_string(self._DefName, 'B'))
def __str__(self):
return '{type}(xForce={xForce}, yForce={yForce}, zForce={zForce}, DefName={DefName})'.format(
type=type(self).__name__,
xForce=self._xForce,
yForce=self._yForce,
zForce=self._zForce,
DefName=msgbuffers.shorten_string(self._DefName))
def __repr__(self):
return '{type}(xForce={xForce}, yForce={yForce}, zForce={zForce}, DefName={DefName})'.format(
type=type(self).__name__,
xForce=repr(self._xForce),
yForce=repr(self._yForce),
zForce=repr(self._zForce),
DefName=repr(self._DefName))
Anki.Cozmo.PhysicsInterface.ApplyForce = ApplyForce
del ApplyForce
class MessageSimPhysics(object):
"Generated message-passing union."
__slots__ = ('_tag', '_data')
class Tag(object):
"The type indicator for this union."
ApplyForce = 0 # Anki.Cozmo.PhysicsInterface.ApplyForce
@property
def tag(self):
"The current tag for this union."
return self._tag
@property
def tag_name(self):
"The name of the current tag for this union."
if self._tag in self._tags_by_value:
return self._tags_by_value[self._tag]
else:
return None
@property
def data(self):
"The data held by this union. None if no data is set."
return self._data
@property
def ApplyForce(self):
"Anki.Cozmo.PhysicsInterface.ApplyForce ApplyForce union property."
msgbuffers.safety_check_tag('ApplyForce', self._tag, self.Tag.ApplyForce, self._tags_by_value)
return self._data
@ApplyForce.setter
def ApplyForce(self, value):
self._data = msgbuffers.validate_object(
'MessageSimPhysics.ApplyForce', value, Anki.Cozmo.PhysicsInterface.ApplyForce)
self._tag = self.Tag.ApplyForce
def __init__(self, **kwargs):
if not kwargs:
self._tag = None
self._data = None
elif len(kwargs) == 1:
key, value = next(iter(kwargs.items()))
if key not in self._tags_by_name:
raise TypeError("'{argument}' is an invalid keyword argument for this method.".format(argument=key))
# calls the correct property
setattr(self, key, value)
else:
raise TypeError('This method only accepts up to one keyword argument.')
@classmethod
def unpack(cls, buffer):
"Reads a new MessageSimPhysics from the given buffer."
reader = msgbuffers.BinaryReader(buffer)
value = cls.unpack_from(reader)
if reader.tell() != len(reader):
raise msgbuffers.ReadError(
('MessageSimPhysics.unpack received a buffer of length {length}, ' +
'but only {position} bytes were read.').format(
length=len(reader), position=reader.tell()))
return value
@classmethod
def unpack_from(cls, reader):
"Reads a new MessageSimPhysics from the given BinaryReader."
tag = reader.read('B')
if tag in cls._tags_by_value:
value = cls()
setattr(value, cls._tags_by_value[tag], cls._tag_unpack_methods[tag](reader))
return value
else:
raise ValueError('MessageSimPhysics attempted to unpack unknown tag {tag}.'.format(tag=tag))
def pack(self):
"Writes the current MessageSimPhysics, returning bytes."
writer = msgbuffers.BinaryWriter()
self.pack_to(writer)
return writer.dumps()
def pack_to(self, writer):
"Writes the current SampleUnion to the given BinaryWriter."
if self._tag in self._tags_by_value:
writer.write(self._tag, 'B')
self._tag_pack_methods[self._tag](writer, self._data)
else:
raise ValueError('Cannot pack an empty MessageSimPhysics.')
def clear(self):
self._tag = None
self._data = None
@classmethod
def typeByTag(cls, tag):
return cls._type_by_tag_value[tag]()
def __eq__(self, other):
if type(self) is type(other):
return self._tag == other._tag and self._data == other._data
else:
return NotImplemented
def __ne__(self, other):
if type(self) is type(other):
return not self.__eq__(other)
else:
return NotImplemented
def __len__(self):
if 0 <= self._tag < 1:
return self._tag_size_methods[self._tag](self._data)
else:
return 1
def __str__(self):
if 0 <= self._tag < 1:
return '{type}({name}={value})'.format(
type=type(self).__name__,
name=self.tag_name,
value=self._data)
else:
return '{type}()'.format(
type=type(self).__name__)
def __repr__(self):
if 0 <= self._tag < 1:
return '{type}({name}={value})'.format(
type=type(self).__name__,
name=self.tag_name,
value=repr(self._data))
else:
return '{type}()'.format(
type=type(self).__name__)
_tags_by_name = dict(
ApplyForce=0,
)
_tags_by_value = dict()
_tags_by_value[0] = 'ApplyForce'
_tag_unpack_methods = dict()
_tag_unpack_methods[0] = lambda reader: reader.read_object(Anki.Cozmo.PhysicsInterface.ApplyForce.unpack_from)
_tag_pack_methods = dict()
_tag_pack_methods[0] = lambda writer, value: writer.write_object(value)
_tag_size_methods = dict()
_tag_size_methods[0] = lambda value: msgbuffers.size_object(value)
_type_by_tag_value = dict()
_type_by_tag_value[0] = lambda : Anki.Cozmo.PhysicsInterface.ApplyForce
Anki.Cozmo.PhysicsInterface.MessageSimPhysics = MessageSimPhysics
del MessageSimPhysics
@@ -0,0 +1,14 @@
# Copyright (c) 2016-2017 Anki, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License in the file LICENSE.txt or at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
@@ -0,0 +1,475 @@
# Copyright (c) 2016-2017 Anki, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License in the file LICENSE.txt or at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""
Autogenerated python message buffer code.
Source: clad/robotInterface/bleMessages.clad
Full command line: ../tools/message-buffers/emitters/Python_emitter.py -C ../robot/clad/src/ -o ../generated/cladPython// clad/robotInterface/bleMessages.clad
"""
from __future__ import absolute_import
from __future__ import print_function
def _modify_path():
import inspect, os, sys
search_paths = [
'../..',
'../../../../tools/message-buffers/support/python',
]
currentpath = os.path.abspath(os.path.dirname(inspect.getfile(inspect.currentframe())))
for search_path in search_paths:
search_path = os.path.normpath(os.path.abspath(os.path.realpath(os.path.join(currentpath, search_path))))
if search_path not in sys.path:
sys.path.insert(0, search_path)
_modify_path()
import msgbuffers
Anki = msgbuffers.Namespace()
Anki.Cozmo = msgbuffers.Namespace()
Anki.Cozmo.BLE = msgbuffers.Namespace()
class BluetoothConstants(object):
"Automatically-generated uint_32 enumeration."
COZMO_FRAME_DATA_LENGTH = 16
Anki.Cozmo.BLE.BluetoothConstants = BluetoothConstants
del BluetoothConstants
class BluetoothConnectionState(object):
"Automatically-generated uint_32 enumeration."
BLE_CONNECTED = 0
BLE_DISCONNECTED_NORMALLY = 1
BLE_CANNOT_CONFIGURE_CONN_PARAMS = 2
Anki.Cozmo.BLE.BluetoothConnectionState = BluetoothConnectionState
del BluetoothConnectionState
class PayloadFlags(object):
"Automatically-generated uint_8 enumeration."
START_OF_MESSAGE = 1
END_OF_MESSAGE = 2
MESSAGE_ENCRYPTED = 4
Anki.Cozmo.BLE.PayloadFlags = PayloadFlags
del PayloadFlags
class Frame(object):
"Generated message-passing structure."
__slots__ = (
'_flags', # uint_8
'_data', # uint_8[16]
)
@property
def flags(self):
"uint_8 flags struct property."
return self._flags
@flags.setter
def flags(self, value):
self._flags = msgbuffers.validate_integer(
'Frame.flags', value, 0, 255)
@property
def data(self):
"uint_8[16] data struct property."
return self._data
@data.setter
def data(self, value):
self._data = msgbuffers.validate_farray(
'Frame.data', value, 16,
lambda name, value_inner: msgbuffers.validate_integer(
name, value_inner, 0, 255))
def __init__(self, flags=0, data=(0,) * 16):
self.flags = flags
self.data = data
@classmethod
def unpack(cls, buffer):
"Reads a new Frame from the given buffer."
reader = msgbuffers.BinaryReader(buffer)
value = cls.unpack_from(reader)
if reader.tell() != len(reader):
raise msgbuffers.ReadError(
('Frame.unpack received a buffer of length {length}, ' +
'but only {position} bytes were read.').format(
length=len(reader), position=reader.tell()))
return value
@classmethod
def unpack_from(cls, reader):
"Reads a new Frame from the given BinaryReader."
_flags = reader.read('B')
_data = reader.read_farray('B', 16)
return cls(_flags, _data)
def pack(self):
"Writes the current Frame, returning bytes."
writer = msgbuffers.BinaryWriter()
self.pack_to(writer)
return writer.dumps()
def pack_to(self, writer):
"Writes the current Frame to the given BinaryWriter."
writer.write(self._flags, 'B')
writer.write_farray(self._data, 'B', 16)
def __eq__(self, other):
if type(self) is type(other):
return (self._flags == other._flags and
self._data == other._data)
else:
return NotImplemented
def __ne__(self, other):
if type(self) is type(other):
return not self.__eq__(other)
else:
return NotImplemented
def __len__(self):
return (msgbuffers.size(self._flags, 'B') +
msgbuffers.size_farray(self._data, 'B', 16))
def __str__(self):
return '{type}(flags={flags}, data={data})'.format(
type=type(self).__name__,
flags=self._flags,
data=msgbuffers.shorten_sequence(self._data))
def __repr__(self):
return '{type}(flags={flags}, data={data})'.format(
type=type(self).__name__,
flags=repr(self._flags),
data=repr(self._data))
Anki.Cozmo.BLE.Frame = Frame
del Frame
class Disconnect(object):
"Generated message-passing message."
__slots__ = (
'_reason', # uint_32
)
@property
def reason(self):
"uint_32 reason struct property."
return self._reason
@reason.setter
def reason(self, value):
self._reason = msgbuffers.validate_integer(
'Disconnect.reason', value, 0, 4294967295)
def __init__(self, reason=0):
self.reason = reason
@classmethod
def unpack(cls, buffer):
"Reads a new Disconnect from the given buffer."
reader = msgbuffers.BinaryReader(buffer)
value = cls.unpack_from(reader)
if reader.tell() != len(reader):
raise msgbuffers.ReadError(
('Disconnect.unpack received a buffer of length {length}, ' +
'but only {position} bytes were read.').format(
length=len(reader), position=reader.tell()))
return value
@classmethod
def unpack_from(cls, reader):
"Reads a new Disconnect from the given BinaryReader."
_reason = reader.read('I')
return cls(_reason)
def pack(self):
"Writes the current Disconnect, returning bytes."
writer = msgbuffers.BinaryWriter()
self.pack_to(writer)
return writer.dumps()
def pack_to(self, writer):
"Writes the current Disconnect to the given BinaryWriter."
writer.write(self._reason, 'I')
def __eq__(self, other):
if type(self) is type(other):
return self._reason == other._reason
else:
return NotImplemented
def __ne__(self, other):
if type(self) is type(other):
return not self.__eq__(other)
else:
return NotImplemented
def __len__(self):
return (msgbuffers.size(self._reason, 'I'))
def __str__(self):
return '{type}(reason={reason})'.format(
type=type(self).__name__,
reason=self._reason)
def __repr__(self):
return '{type}(reason={reason})'.format(
type=type(self).__name__,
reason=repr(self._reason))
Anki.Cozmo.BLE.Disconnect = Disconnect
del Disconnect
class ConnectionState(object):
"Generated message-passing message."
__slots__ = (
'_state', # uint_32
)
@property
def state(self):
"uint_32 state struct property."
return self._state
@state.setter
def state(self, value):
self._state = msgbuffers.validate_integer(
'ConnectionState.state', value, 0, 4294967295)
def __init__(self, state=0):
self.state = state
@classmethod
def unpack(cls, buffer):
"Reads a new ConnectionState from the given buffer."
reader = msgbuffers.BinaryReader(buffer)
value = cls.unpack_from(reader)
if reader.tell() != len(reader):
raise msgbuffers.ReadError(
('ConnectionState.unpack received a buffer of length {length}, ' +
'but only {position} bytes were read.').format(
length=len(reader), position=reader.tell()))
return value
@classmethod
def unpack_from(cls, reader):
"Reads a new ConnectionState from the given BinaryReader."
_state = reader.read('I')
return cls(_state)
def pack(self):
"Writes the current ConnectionState, returning bytes."
writer = msgbuffers.BinaryWriter()
self.pack_to(writer)
return writer.dumps()
def pack_to(self, writer):
"Writes the current ConnectionState to the given BinaryWriter."
writer.write(self._state, 'I')
def __eq__(self, other):
if type(self) is type(other):
return self._state == other._state
else:
return NotImplemented
def __ne__(self, other):
if type(self) is type(other):
return not self.__eq__(other)
else:
return NotImplemented
def __len__(self):
return (msgbuffers.size(self._state, 'I'))
def __str__(self):
return '{type}(state={state})'.format(
type=type(self).__name__,
state=self._state)
def __repr__(self):
return '{type}(state={state})'.format(
type=type(self).__name__,
state=repr(self._state))
Anki.Cozmo.BLE.ConnectionState = ConnectionState
del ConnectionState
class DataReceived(object):
"Generated message-passing message."
__slots__ = (
'_frame', # Anki.Cozmo.BLE.Frame
)
@property
def frame(self):
"Anki.Cozmo.BLE.Frame frame struct property."
return self._frame
@frame.setter
def frame(self, value):
self._frame = msgbuffers.validate_object(
'DataReceived.frame', value, Anki.Cozmo.BLE.Frame)
def __init__(self, frame=Anki.Cozmo.BLE.Frame()):
self.frame = frame
@classmethod
def unpack(cls, buffer):
"Reads a new DataReceived from the given buffer."
reader = msgbuffers.BinaryReader(buffer)
value = cls.unpack_from(reader)
if reader.tell() != len(reader):
raise msgbuffers.ReadError(
('DataReceived.unpack received a buffer of length {length}, ' +
'but only {position} bytes were read.').format(
length=len(reader), position=reader.tell()))
return value
@classmethod
def unpack_from(cls, reader):
"Reads a new DataReceived from the given BinaryReader."
_frame = reader.read_object(Anki.Cozmo.BLE.Frame.unpack_from)
return cls(_frame)
def pack(self):
"Writes the current DataReceived, returning bytes."
writer = msgbuffers.BinaryWriter()
self.pack_to(writer)
return writer.dumps()
def pack_to(self, writer):
"Writes the current DataReceived to the given BinaryWriter."
writer.write_object(self._frame)
def __eq__(self, other):
if type(self) is type(other):
return self._frame == other._frame
else:
return NotImplemented
def __ne__(self, other):
if type(self) is type(other):
return not self.__eq__(other)
else:
return NotImplemented
def __len__(self):
return (msgbuffers.size_object(self._frame))
def __str__(self):
return '{type}(frame={frame})'.format(
type=type(self).__name__,
frame=self._frame)
def __repr__(self):
return '{type}(frame={frame})'.format(
type=type(self).__name__,
frame=repr(self._frame))
Anki.Cozmo.BLE.DataReceived = DataReceived
del DataReceived
class SendData(object):
"Generated message-passing message."
__slots__ = (
'_frame', # Anki.Cozmo.BLE.Frame
)
@property
def frame(self):
"Anki.Cozmo.BLE.Frame frame struct property."
return self._frame
@frame.setter
def frame(self, value):
self._frame = msgbuffers.validate_object(
'SendData.frame', value, Anki.Cozmo.BLE.Frame)
def __init__(self, frame=Anki.Cozmo.BLE.Frame()):
self.frame = frame
@classmethod
def unpack(cls, buffer):
"Reads a new SendData from the given buffer."
reader = msgbuffers.BinaryReader(buffer)
value = cls.unpack_from(reader)
if reader.tell() != len(reader):
raise msgbuffers.ReadError(
('SendData.unpack received a buffer of length {length}, ' +
'but only {position} bytes were read.').format(
length=len(reader), position=reader.tell()))
return value
@classmethod
def unpack_from(cls, reader):
"Reads a new SendData from the given BinaryReader."
_frame = reader.read_object(Anki.Cozmo.BLE.Frame.unpack_from)
return cls(_frame)
def pack(self):
"Writes the current SendData, returning bytes."
writer = msgbuffers.BinaryWriter()
self.pack_to(writer)
return writer.dumps()
def pack_to(self, writer):
"Writes the current SendData to the given BinaryWriter."
writer.write_object(self._frame)
def __eq__(self, other):
if type(self) is type(other):
return self._frame == other._frame
else:
return NotImplemented
def __ne__(self, other):
if type(self) is type(other):
return not self.__eq__(other)
else:
return NotImplemented
def __len__(self):
return (msgbuffers.size_object(self._frame))
def __str__(self):
return '{type}(frame={frame})'.format(
type=type(self).__name__,
frame=self._frame)
def __repr__(self):
return '{type}(frame={frame})'.format(
type=type(self).__name__,
frame=repr(self._frame))
Anki.Cozmo.BLE.SendData = SendData
del SendData
@@ -0,0 +1,718 @@
# Copyright (c) 2016-2017 Anki, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License in the file LICENSE.txt or at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""
Autogenerated python message buffer code.
Source: clad/robotInterface/messageToActiveObject.clad
Full command line: ../tools/message-buffers/emitters/Python_emitter.py -C ../robot/clad/src/ -o ../generated/cladPython// clad/robotInterface/messageToActiveObject.clad
"""
from __future__ import absolute_import
from __future__ import print_function
def _modify_path():
import inspect, os, sys
search_paths = [
'../..',
'../../../../tools/message-buffers/support/python',
]
currentpath = os.path.abspath(os.path.dirname(inspect.getfile(inspect.currentframe())))
for search_path in search_paths:
search_path = os.path.normpath(os.path.abspath(os.path.realpath(os.path.join(currentpath, search_path))))
if search_path not in sys.path:
sys.path.insert(0, search_path)
_modify_path()
import msgbuffers
Anki = msgbuffers.Namespace()
Anki.Cozmo = msgbuffers.Namespace()
from clad.types.ledTypes import Anki as _Anki
Anki.update(_Anki.deep_clone())
class SetAccessoryDiscovery(object):
"Generated message-passing message."
__slots__ = (
'_enable', # bool
)
@property
def enable(self):
"bool enable struct property."
return self._enable
@enable.setter
def enable(self, value):
self._enable = msgbuffers.validate_bool(
'SetAccessoryDiscovery.enable', value)
def __init__(self, enable=False):
self.enable = enable
@classmethod
def unpack(cls, buffer):
"Reads a new SetAccessoryDiscovery from the given buffer."
reader = msgbuffers.BinaryReader(buffer)
value = cls.unpack_from(reader)
if reader.tell() != len(reader):
raise msgbuffers.ReadError(
('SetAccessoryDiscovery.unpack received a buffer of length {length}, ' +
'but only {position} bytes were read.').format(
length=len(reader), position=reader.tell()))
return value
@classmethod
def unpack_from(cls, reader):
"Reads a new SetAccessoryDiscovery from the given BinaryReader."
_enable = bool(reader.read('b'))
return cls(_enable)
def pack(self):
"Writes the current SetAccessoryDiscovery, returning bytes."
writer = msgbuffers.BinaryWriter()
self.pack_to(writer)
return writer.dumps()
def pack_to(self, writer):
"Writes the current SetAccessoryDiscovery to the given BinaryWriter."
writer.write(int(self._enable), 'b')
def __eq__(self, other):
if type(self) is type(other):
return self._enable == other._enable
else:
return NotImplemented
def __ne__(self, other):
if type(self) is type(other):
return not self.__eq__(other)
else:
return NotImplemented
def __len__(self):
return (msgbuffers.size(self._enable, 'b'))
def __str__(self):
return '{type}(enable={enable})'.format(
type=type(self).__name__,
enable=self._enable)
def __repr__(self):
return '{type}(enable={enable})'.format(
type=type(self).__name__,
enable=repr(self._enable))
Anki.Cozmo.SetAccessoryDiscovery = SetAccessoryDiscovery
del SetAccessoryDiscovery
class CubeID(object):
"Generated message-passing message."
__slots__ = (
'_objectID', # uint_32
'_rotationPeriod_frames', # uint_8
)
@property
def objectID(self):
"uint_32 objectID struct property."
return self._objectID
@objectID.setter
def objectID(self, value):
self._objectID = msgbuffers.validate_integer(
'CubeID.objectID', value, 0, 4294967295)
@property
def rotationPeriod_frames(self):
"uint_8 rotationPeriod_frames struct property."
return self._rotationPeriod_frames
@rotationPeriod_frames.setter
def rotationPeriod_frames(self, value):
self._rotationPeriod_frames = msgbuffers.validate_integer(
'CubeID.rotationPeriod_frames', value, 0, 255)
def __init__(self, objectID=0, rotationPeriod_frames=0):
self.objectID = objectID
self.rotationPeriod_frames = rotationPeriod_frames
@classmethod
def unpack(cls, buffer):
"Reads a new CubeID from the given buffer."
reader = msgbuffers.BinaryReader(buffer)
value = cls.unpack_from(reader)
if reader.tell() != len(reader):
raise msgbuffers.ReadError(
('CubeID.unpack received a buffer of length {length}, ' +
'but only {position} bytes were read.').format(
length=len(reader), position=reader.tell()))
return value
@classmethod
def unpack_from(cls, reader):
"Reads a new CubeID from the given BinaryReader."
_objectID = reader.read('I')
_rotationPeriod_frames = reader.read('B')
return cls(_objectID, _rotationPeriod_frames)
def pack(self):
"Writes the current CubeID, returning bytes."
writer = msgbuffers.BinaryWriter()
self.pack_to(writer)
return writer.dumps()
def pack_to(self, writer):
"Writes the current CubeID to the given BinaryWriter."
writer.write(self._objectID, 'I')
writer.write(self._rotationPeriod_frames, 'B')
def __eq__(self, other):
if type(self) is type(other):
return (self._objectID == other._objectID and
self._rotationPeriod_frames == other._rotationPeriod_frames)
else:
return NotImplemented
def __ne__(self, other):
if type(self) is type(other):
return not self.__eq__(other)
else:
return NotImplemented
def __len__(self):
return (msgbuffers.size(self._objectID, 'I') +
msgbuffers.size(self._rotationPeriod_frames, 'B'))
def __str__(self):
return '{type}(objectID={objectID}, rotationPeriod_frames={rotationPeriod_frames})'.format(
type=type(self).__name__,
objectID=self._objectID,
rotationPeriod_frames=self._rotationPeriod_frames)
def __repr__(self):
return '{type}(objectID={objectID}, rotationPeriod_frames={rotationPeriod_frames})'.format(
type=type(self).__name__,
objectID=repr(self._objectID),
rotationPeriod_frames=repr(self._rotationPeriod_frames))
Anki.Cozmo.CubeID = CubeID
del CubeID
class CubeLights(object):
"Generated message-passing message."
__slots__ = (
'_lights', # LightState[4]
)
@property
def lights(self):
"LightState[4] lights struct property."
return self._lights
@lights.setter
def lights(self, value):
self._lights = msgbuffers.validate_farray(
'CubeLights.lights', value, 4,
lambda name, value_inner: msgbuffers.validate_object(
name, value_inner, Anki.Cozmo.LightState))
def __init__(self, lights=(Anki.Cozmo.LightState(),) * 4):
self.lights = lights
@classmethod
def unpack(cls, buffer):
"Reads a new CubeLights from the given buffer."
reader = msgbuffers.BinaryReader(buffer)
value = cls.unpack_from(reader)
if reader.tell() != len(reader):
raise msgbuffers.ReadError(
('CubeLights.unpack received a buffer of length {length}, ' +
'but only {position} bytes were read.').format(
length=len(reader), position=reader.tell()))
return value
@classmethod
def unpack_from(cls, reader):
"Reads a new CubeLights from the given BinaryReader."
_lights = reader.read_object_farray(Anki.Cozmo.LightState.unpack_from, 4)
return cls(_lights)
def pack(self):
"Writes the current CubeLights, returning bytes."
writer = msgbuffers.BinaryWriter()
self.pack_to(writer)
return writer.dumps()
def pack_to(self, writer):
"Writes the current CubeLights to the given BinaryWriter."
writer.write_object_farray(self._lights, 4)
def __eq__(self, other):
if type(self) is type(other):
return self._lights == other._lights
else:
return NotImplemented
def __ne__(self, other):
if type(self) is type(other):
return not self.__eq__(other)
else:
return NotImplemented
def __len__(self):
return (msgbuffers.size_object_farray(self._lights, 4))
def __str__(self):
return '{type}(lights={lights})'.format(
type=type(self).__name__,
lights=msgbuffers.shorten_sequence(self._lights))
def __repr__(self):
return '{type}(lights={lights})'.format(
type=type(self).__name__,
lights=repr(self._lights))
Anki.Cozmo.CubeLights = CubeLights
del CubeLights
class FlashObjectIDs(object):
"Generated message-passing message."
__slots__ = (
'_objectID', # uint_32
)
@property
def objectID(self):
"uint_32 objectID struct property."
return self._objectID
@objectID.setter
def objectID(self, value):
self._objectID = msgbuffers.validate_integer(
'FlashObjectIDs.objectID', value, 0, 4294967295)
def __init__(self, objectID=0):
self.objectID = objectID
@classmethod
def unpack(cls, buffer):
"Reads a new FlashObjectIDs from the given buffer."
reader = msgbuffers.BinaryReader(buffer)
value = cls.unpack_from(reader)
if reader.tell() != len(reader):
raise msgbuffers.ReadError(
('FlashObjectIDs.unpack received a buffer of length {length}, ' +
'but only {position} bytes were read.').format(
length=len(reader), position=reader.tell()))
return value
@classmethod
def unpack_from(cls, reader):
"Reads a new FlashObjectIDs from the given BinaryReader."
_objectID = reader.read('I')
return cls(_objectID)
def pack(self):
"Writes the current FlashObjectIDs, returning bytes."
writer = msgbuffers.BinaryWriter()
self.pack_to(writer)
return writer.dumps()
def pack_to(self, writer):
"Writes the current FlashObjectIDs to the given BinaryWriter."
writer.write(self._objectID, 'I')
def __eq__(self, other):
if type(self) is type(other):
return self._objectID == other._objectID
else:
return NotImplemented
def __ne__(self, other):
if type(self) is type(other):
return not self.__eq__(other)
else:
return NotImplemented
def __len__(self):
return (msgbuffers.size(self._objectID, 'I'))
def __str__(self):
return '{type}(objectID={objectID})'.format(
type=type(self).__name__,
objectID=self._objectID)
def __repr__(self):
return '{type}(objectID={objectID})'.format(
type=type(self).__name__,
objectID=repr(self._objectID))
Anki.Cozmo.FlashObjectIDs = FlashObjectIDs
del FlashObjectIDs
class ObjectBeingCarried(object):
"Generated message-passing message."
__slots__ = (
'_objectID', # uint_32
'_isBeingCarried', # bool
)
@property
def objectID(self):
"uint_32 objectID struct property."
return self._objectID
@objectID.setter
def objectID(self, value):
self._objectID = msgbuffers.validate_integer(
'ObjectBeingCarried.objectID', value, 0, 4294967295)
@property
def isBeingCarried(self):
"bool isBeingCarried struct property."
return self._isBeingCarried
@isBeingCarried.setter
def isBeingCarried(self, value):
self._isBeingCarried = msgbuffers.validate_bool(
'ObjectBeingCarried.isBeingCarried', value)
def __init__(self, objectID=0, isBeingCarried=False):
self.objectID = objectID
self.isBeingCarried = isBeingCarried
@classmethod
def unpack(cls, buffer):
"Reads a new ObjectBeingCarried from the given buffer."
reader = msgbuffers.BinaryReader(buffer)
value = cls.unpack_from(reader)
if reader.tell() != len(reader):
raise msgbuffers.ReadError(
('ObjectBeingCarried.unpack received a buffer of length {length}, ' +
'but only {position} bytes were read.').format(
length=len(reader), position=reader.tell()))
return value
@classmethod
def unpack_from(cls, reader):
"Reads a new ObjectBeingCarried from the given BinaryReader."
_objectID = reader.read('I')
_isBeingCarried = bool(reader.read('b'))
return cls(_objectID, _isBeingCarried)
def pack(self):
"Writes the current ObjectBeingCarried, returning bytes."
writer = msgbuffers.BinaryWriter()
self.pack_to(writer)
return writer.dumps()
def pack_to(self, writer):
"Writes the current ObjectBeingCarried to the given BinaryWriter."
writer.write(self._objectID, 'I')
writer.write(int(self._isBeingCarried), 'b')
def __eq__(self, other):
if type(self) is type(other):
return (self._objectID == other._objectID and
self._isBeingCarried == other._isBeingCarried)
else:
return NotImplemented
def __ne__(self, other):
if type(self) is type(other):
return not self.__eq__(other)
else:
return NotImplemented
def __len__(self):
return (msgbuffers.size(self._objectID, 'I') +
msgbuffers.size(self._isBeingCarried, 'b'))
def __str__(self):
return '{type}(objectID={objectID}, isBeingCarried={isBeingCarried})'.format(
type=type(self).__name__,
objectID=self._objectID,
isBeingCarried=self._isBeingCarried)
def __repr__(self):
return '{type}(objectID={objectID}, isBeingCarried={isBeingCarried})'.format(
type=type(self).__name__,
objectID=repr(self._objectID),
isBeingCarried=repr(self._isBeingCarried))
Anki.Cozmo.ObjectBeingCarried = ObjectBeingCarried
del ObjectBeingCarried
class StreamObjectAccel(object):
"Generated message-passing message."
__slots__ = (
'_objectID', # uint_32
'_enable', # bool
)
@property
def objectID(self):
"uint_32 objectID struct property."
return self._objectID
@objectID.setter
def objectID(self, value):
self._objectID = msgbuffers.validate_integer(
'StreamObjectAccel.objectID', value, 0, 4294967295)
@property
def enable(self):
"bool enable struct property."
return self._enable
@enable.setter
def enable(self, value):
self._enable = msgbuffers.validate_bool(
'StreamObjectAccel.enable', value)
def __init__(self, objectID=0, enable=False):
self.objectID = objectID
self.enable = enable
@classmethod
def unpack(cls, buffer):
"Reads a new StreamObjectAccel from the given buffer."
reader = msgbuffers.BinaryReader(buffer)
value = cls.unpack_from(reader)
if reader.tell() != len(reader):
raise msgbuffers.ReadError(
('StreamObjectAccel.unpack received a buffer of length {length}, ' +
'but only {position} bytes were read.').format(
length=len(reader), position=reader.tell()))
return value
@classmethod
def unpack_from(cls, reader):
"Reads a new StreamObjectAccel from the given BinaryReader."
_objectID = reader.read('I')
_enable = bool(reader.read('b'))
return cls(_objectID, _enable)
def pack(self):
"Writes the current StreamObjectAccel, returning bytes."
writer = msgbuffers.BinaryWriter()
self.pack_to(writer)
return writer.dumps()
def pack_to(self, writer):
"Writes the current StreamObjectAccel to the given BinaryWriter."
writer.write(self._objectID, 'I')
writer.write(int(self._enable), 'b')
def __eq__(self, other):
if type(self) is type(other):
return (self._objectID == other._objectID and
self._enable == other._enable)
else:
return NotImplemented
def __ne__(self, other):
if type(self) is type(other):
return not self.__eq__(other)
else:
return NotImplemented
def __len__(self):
return (msgbuffers.size(self._objectID, 'I') +
msgbuffers.size(self._enable, 'b'))
def __str__(self):
return '{type}(objectID={objectID}, enable={enable})'.format(
type=type(self).__name__,
objectID=self._objectID,
enable=self._enable)
def __repr__(self):
return '{type}(objectID={objectID}, enable={enable})'.format(
type=type(self).__name__,
objectID=repr(self._objectID),
enable=repr(self._enable))
Anki.Cozmo.StreamObjectAccel = StreamObjectAccel
del StreamObjectAccel
class SetPropState(object):
"Generated message-passing structure."
__slots__ = (
'_colors', # uint_16[4]
'_slot', # uint_8
)
@property
def colors(self):
"uint_16[4] colors struct property."
return self._colors
@colors.setter
def colors(self, value):
self._colors = msgbuffers.validate_farray(
'SetPropState.colors', value, 4,
lambda name, value_inner: msgbuffers.validate_integer(
name, value_inner, 0, 65535))
@property
def slot(self):
"uint_8 slot struct property."
return self._slot
@slot.setter
def slot(self, value):
self._slot = msgbuffers.validate_integer(
'SetPropState.slot', value, 0, 255)
def __init__(self, colors=(0,) * 4, slot=0):
self.colors = colors
self.slot = slot
@classmethod
def unpack(cls, buffer):
"Reads a new SetPropState from the given buffer."
reader = msgbuffers.BinaryReader(buffer)
value = cls.unpack_from(reader)
if reader.tell() != len(reader):
raise msgbuffers.ReadError(
('SetPropState.unpack received a buffer of length {length}, ' +
'but only {position} bytes were read.').format(
length=len(reader), position=reader.tell()))
return value
@classmethod
def unpack_from(cls, reader):
"Reads a new SetPropState from the given BinaryReader."
_colors = reader.read_farray('H', 4)
_slot = reader.read('B')
return cls(_colors, _slot)
def pack(self):
"Writes the current SetPropState, returning bytes."
writer = msgbuffers.BinaryWriter()
self.pack_to(writer)
return writer.dumps()
def pack_to(self, writer):
"Writes the current SetPropState to the given BinaryWriter."
writer.write_farray(self._colors, 'H', 4)
writer.write(self._slot, 'B')
def __eq__(self, other):
if type(self) is type(other):
return (self._colors == other._colors and
self._slot == other._slot)
else:
return NotImplemented
def __ne__(self, other):
if type(self) is type(other):
return not self.__eq__(other)
else:
return NotImplemented
def __len__(self):
return (msgbuffers.size_farray(self._colors, 'H', 4) +
msgbuffers.size(self._slot, 'B'))
def __str__(self):
return '{type}(colors={colors}, slot={slot})'.format(
type=type(self).__name__,
colors=msgbuffers.shorten_sequence(self._colors),
slot=self._slot)
def __repr__(self):
return '{type}(colors={colors}, slot={slot})'.format(
type=type(self).__name__,
colors=repr(self._colors),
slot=repr(self._slot))
Anki.Cozmo.SetPropState = SetPropState
del SetPropState
class KillBodyCode(object):
"Generated message-passing message."
__slots__ = ()
def __init__(self):
pass
@classmethod
def unpack(cls, buffer):
"Reads a new KillBodyCode from the given buffer."
reader = msgbuffers.BinaryReader(buffer)
value = cls.unpack_from(reader)
if reader.tell() != len(reader):
raise msgbuffers.ReadError(
('KillBodyCode.unpack received a buffer of length {length}, ' +
'but only {position} bytes were read.').format(
length=len(reader), position=reader.tell()))
return value
@classmethod
def unpack_from(cls, reader):
"Reads a new KillBodyCode from the given BinaryReader."
return cls()
def pack(self):
"Writes the current KillBodyCode, returning bytes."
writer = msgbuffers.BinaryWriter()
self.pack_to(writer)
return writer.dumps()
def pack_to(self, writer):
"Writes the current KillBodyCode to the given BinaryWriter."
def __eq__(self, other):
if type(self) is type(other):
return True
else:
return NotImplemented
def __ne__(self, other):
if type(self) is type(other):
return not self.__eq__(other)
else:
return NotImplemented
def __len__(self):
return 0
def __str__(self):
return '{type}()'.format(type=type(self).__name__)
def __repr__(self):
return '{type}()'.format(type=type(self).__name__)
Anki.Cozmo.KillBodyCode = KillBodyCode
del KillBodyCode
@@ -0,0 +1,14 @@
# Copyright (c) 2016-2017 Anki, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License in the file LICENSE.txt or at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

Some files were not shown because too many files have changed in this diff Show More