<s> from __future__ import absolute_import <EOL> __author__ = '<STR_LIT>' <EOL> from enum import IntEnum <EOL> from . base import PebblePacket <EOL> from . base . types import * <EOL> __all__ = [ "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , <EOL> "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , <EOL> "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , <EOL> "<STR_LIT>" ] <EOL> class AudioCodec ( IntEnum ) : <EOL> Speex = <NUM_LIT> <EOL> class SpeexEncoderInfo ( PebblePacket ) : <EOL> version = FixedString ( <NUM_LIT:20> ) <EOL> sample_rate = Uint32 ( ) <EOL> bit_rate = Uint16 ( ) <EOL> bitstream_version = Uint8 ( ) <EOL> frame_size = Uint16 ( ) <EOL> class Word ( PebblePacket ) : <EOL> confidence = Uint8 ( ) <EOL> length = Uint16 ( ) <EOL> data = FixedString ( length = length ) <EOL> class Sentence ( PebblePacket ) : <EOL> count = Uint16 ( ) <EOL> words = FixedList ( Word , count = count ) <EOL> class SentenceList ( PebblePacket ) : <EOL> count = Uint8 ( ) <EOL> sentences = FixedList ( Sentence , count = count ) <EOL> class TranscriptionType ( IntEnum ) : <EOL> SentenceList = <NUM_LIT> <EOL> class Transcription ( PebblePacket ) : <EOL> type = Uint8 ( enum = TranscriptionType ) <EOL> transcription = Union ( type , { <EOL> TranscriptionType . SentenceList : SentenceList <EOL> } ) <EOL> class AppUuid ( PebblePacket ) : <EOL> uuid = UUID ( ) <EOL> class AttributeType ( IntEnum ) : <EOL> SpeexEncoderInfo = <NUM_LIT> <EOL> Transcription = <NUM_LIT> <EOL> AppUuid = <NUM_LIT> <EOL> class Attribute ( PebblePacket ) : <EOL> id = Uint8 ( enum = AttributeType ) <EOL> length = Uint16 ( ) <EOL> data = Union ( id , { <EOL> AttributeType . SpeexEncoderInfo : SpeexEncoderInfo , <EOL> AttributeType . Transcription : Transcription , <EOL> AttributeType . AppUuid : AppUuid , <EOL> } , length = length , accept_missing = True ) <EOL> class AttributeList ( PebblePacket ) : <EOL> count = Uint8 ( ) <EOL> dictionary = FixedList ( Attribute , count = count ) <EOL> def get_attribute ( self , id ) : <EOL> if self . is_empty ( ) : <EOL> return None <EOL> for attr in self . dictionary : <EOL> assert isinstance ( attr , Attribute ) <EOL> if attr . id == id : <EOL> return attr . data <EOL> return None <EOL> def is_empty ( self ) : <EOL> return len ( self . dictionary ) == <NUM_LIT:0> <EOL> class SessionType ( IntEnum ) : <EOL> Dictation = <NUM_LIT> <EOL> Command = <NUM_LIT> <EOL> class SessionSetupCommand ( PebblePacket ) : <EOL> session_type = Uint8 ( enum = SessionType ) <EOL> session_id = Uint16 ( ) <EOL> attributes = Embed ( AttributeList ) <EOL> class Command ( IntEnum ) : <EOL> SessionSetup = <NUM_LIT> <EOL> DictationResult = <NUM_LIT> <EOL> class VoiceControlCommand ( PebblePacket ) : <EOL> class Meta : <EOL> endpoint = <NUM_LIT> <EOL> endianness = '<STR_LIT:<>' <EOL> command = Uint8 ( enum = Command ) <EOL> flags = Uint32 ( ) <EOL> data = Union ( command , { <EOL> Command . SessionSetup : SessionSetupCommand , <EOL> } ) <EOL> class Result ( IntEnum ) : <EOL> Success = <NUM_LIT> <EOL> FailServiceUnavailable = <NUM_LIT> <EOL> FailTimeout = <NUM_LIT> <EOL> FailRecognizerError = <NUM_LIT> <EOL> FailInvalidRecognizerResponse = <NUM_LIT> <EOL> FailDisabled = <NUM_LIT> <EOL> FailInvalidMessage = <NUM_LIT> <EOL> class Flags ( object ) : <EOL> AppInitiated = <NUM_LIT:1> <EOL> class SessionSetupResult ( PebblePacket ) : <EOL> session_type = Uint8 ( enum = SessionType ) <EOL> result = Uint8 ( enum = Result ) <EOL> class DictationResult ( PebblePacket ) : <EOL> session_id = Uint16 ( ) <EOL> result = Uint8 ( enum = Result ) <EOL> attributes = Embed ( AttributeList ) <EOL> class VoiceControlResult ( PebblePacket ) : <EOL> class Meta : <EOL> endpoint = <NUM_LIT> <EOL> endianness = '<STR_LIT:<>' <EOL> register = False <EOL> command = Uint8 ( enum = Command ) <EOL> flags = Uint32 ( ) <EOL> data = Union ( command , { <EOL> Command . SessionSetup : SessionSetupResult , <EOL> Command . DictationResult : DictationResult <EOL> } ) </s>
