# THIS FILE IS AUTOMATICALLY GENERATED.  EDIT THE SOURCE FILE NOT THIS ONE

"""Various descriptions of data specific to Sanyo MM-3100"""

from prototypes import *

# Make all sanyo stuff available in this module as well
from p_sanyo import *
from p_sanyomedia import *
from p_sanyonewer import *
from p_brew import *

# We use LSB for all integer like fields
UINT=UINTlsb
BOOL=BOOLlsb
_NUMPBSLOTS=300
_NUMSPEEDDIALS=8
_NUMLONGNUMBERS=5
_LONGPHONENUMBERLEN=30
_NUMEVENTSLOTS=100
_NUMCALLALARMSLOTS=15
 # Need to check.  Is max phone will hold 32/96 or 33/97
_MAXNUMBERLEN=32
_MAXEMAILLEN=96
HASRINGPICBUF=0

#BREW_FILE_SYSTEM=2

class req41(BaseProtogenClass):
    __fields=['fortyone', 'msl']

    def __init__(self, *args, **kwargs):
        dict={}
        # What was supplied to this function
        dict.update(kwargs)
        # Parent constructor
        super(req41,self).__init__(**dict)
        if self.__class__ is req41:
            self._update(args,dict)


    def getfields(self):
        return self.__fields


    def _update(self, args, kwargs):
        super(req41,self)._update(args,kwargs)
        keys=kwargs.keys()
        for key in keys:
            if key in self.__fields:
                setattr(self, key, kwargs[key])
                del kwargs[key]
        # Were any unrecognized kwargs passed in?
        if __debug__:
            self._complainaboutunusedargs(req41,kwargs)
        if len(args): raise TypeError('Unexpected arguments supplied: '+`args`)
        # Make all P fields that haven't already been constructed


    def writetobuffer(self,buf,autolog=True,logtitle="<written data>"):
        'Writes this packet to the supplied buffer'
        self._bufferstartoffset=buf.getcurrentoffset()
        try: self.__field_fortyone
        except:
            self.__field_fortyone=UINT(**{'sizeinbytes': 1, 'default': 0x41})
        self.__field_fortyone.writetobuffer(buf)
        self.__field_msl.writetobuffer(buf)
        self._bufferendoffset=buf.getcurrentoffset()
        if autolog and self._bufferstartoffset==0: self.autologwrite(buf, logtitle=logtitle)


    def readfrombuffer(self,buf,autolog=True,logtitle="<read data>"):
        'Reads this packet from the supplied buffer'
        self._bufferstartoffset=buf.getcurrentoffset()
        if autolog and self._bufferstartoffset==0: self.autologread(buf, logtitle=logtitle)
        self.__field_fortyone=UINT(**{'sizeinbytes': 1, 'default': 0x41})
        self.__field_fortyone.readfrombuffer(buf)
        self.__field_msl=USTRING(**{'sizeinbytes': 6, 'terminator': None})
        self.__field_msl.readfrombuffer(buf)
        self._bufferendoffset=buf.getcurrentoffset()


    def __getfield_fortyone(self):
        try: self.__field_fortyone
        except:
            self.__field_fortyone=UINT(**{'sizeinbytes': 1, 'default': 0x41})
        return self.__field_fortyone.getvalue()

    def __setfield_fortyone(self, value):
        if isinstance(value,UINT):
            self.__field_fortyone=value
        else:
            self.__field_fortyone=UINT(value,**{'sizeinbytes': 1, 'default': 0x41})

    def __delfield_fortyone(self): del self.__field_fortyone

    fortyone=property(__getfield_fortyone, __setfield_fortyone, __delfield_fortyone, None)

    def __getfield_msl(self):
        return self.__field_msl.getvalue()

    def __setfield_msl(self, value):
        if isinstance(value,USTRING):
            self.__field_msl=value
        else:
            self.__field_msl=USTRING(value,**{'sizeinbytes': 6, 'terminator': None})

    def __delfield_msl(self): del self.__field_msl

    msl=property(__getfield_msl, __setfield_msl, __delfield_msl, None)

    def iscontainer(self):
        return True

    def containerelements(self):
        yield ('fortyone', self.__field_fortyone, None)
        yield ('msl', self.__field_msl, None)




class res41(BaseProtogenClass):
    __fields=['fortyone', 'ans']

    def __init__(self, *args, **kwargs):
        dict={}
        # What was supplied to this function
        dict.update(kwargs)
        # Parent constructor
        super(res41,self).__init__(**dict)
        if self.__class__ is res41:
            self._update(args,dict)


    def getfields(self):
        return self.__fields


    def _update(self, args, kwargs):
        super(res41,self)._update(args,kwargs)
        keys=kwargs.keys()
        for key in keys:
            if key in self.__fields:
                setattr(self, key, kwargs[key])
                del kwargs[key]
        # Were any unrecognized kwargs passed in?
        if __debug__:
            self._complainaboutunusedargs(res41,kwargs)
        if len(args): raise TypeError('Unexpected arguments supplied: '+`args`)
        # Make all P fields that haven't already been constructed


    def writetobuffer(self,buf,autolog=True,logtitle="<written data>"):
        'Writes this packet to the supplied buffer'
        self._bufferstartoffset=buf.getcurrentoffset()
        self.__field_fortyone.writetobuffer(buf)
        self.__field_ans.writetobuffer(buf)
        self._bufferendoffset=buf.getcurrentoffset()
        if autolog and self._bufferstartoffset==0: self.autologwrite(buf, logtitle=logtitle)


    def readfrombuffer(self,buf,autolog=True,logtitle="<read data>"):
        'Reads this packet from the supplied buffer'
        self._bufferstartoffset=buf.getcurrentoffset()
        if autolog and self._bufferstartoffset==0: self.autologread(buf, logtitle=logtitle)
        self.__field_fortyone=UINT(**{'sizeinbytes': 1, 'default': 0x41})
        self.__field_fortyone.readfrombuffer(buf)
        self.__field_ans=UINT(**{'sizeinbytes': 1})
        self.__field_ans.readfrombuffer(buf)
        self._bufferendoffset=buf.getcurrentoffset()


    def __getfield_fortyone(self):
        return self.__field_fortyone.getvalue()

    def __setfield_fortyone(self, value):
        if isinstance(value,UINT):
            self.__field_fortyone=value
        else:
            self.__field_fortyone=UINT(value,**{'sizeinbytes': 1, 'default': 0x41})

    def __delfield_fortyone(self): del self.__field_fortyone

    fortyone=property(__getfield_fortyone, __setfield_fortyone, __delfield_fortyone, None)

    def __getfield_ans(self):
        return self.__field_ans.getvalue()

    def __setfield_ans(self, value):
        if isinstance(value,UINT):
            self.__field_ans=value
        else:
            self.__field_ans=UINT(value,**{'sizeinbytes': 1})

    def __delfield_ans(self): del self.__field_ans

    ans=property(__getfield_ans, __setfield_ans, __delfield_ans, None)

    def iscontainer(self):
        return True

    def containerelements(self):
        yield ('fortyone', self.__field_fortyone, None)
        yield ('ans', self.__field_ans, None)




class fastatusrequest(BaseProtogenClass):
    __fields=['preamble', 'command', 'packettype']

    def __init__(self, *args, **kwargs):
        dict={}
        # What was supplied to this function
        dict.update(kwargs)
        # Parent constructor
        super(fastatusrequest,self).__init__(**dict)
        if self.__class__ is fastatusrequest:
            self._update(args,dict)


    def getfields(self):
        return self.__fields


    def _update(self, args, kwargs):
        super(fastatusrequest,self)._update(args,kwargs)
        keys=kwargs.keys()
        for key in keys:
            if key in self.__fields:
                setattr(self, key, kwargs[key])
                del kwargs[key]
        # Were any unrecognized kwargs passed in?
        if __debug__:
            self._complainaboutunusedargs(fastatusrequest,kwargs)
        if len(args): raise TypeError('Unexpected arguments supplied: '+`args`)
        # Make all P fields that haven't already been constructed


    def writetobuffer(self,buf,autolog=True,logtitle="<written data>"):
        'Writes this packet to the supplied buffer'
        self._bufferstartoffset=buf.getcurrentoffset()
        try: self.__field_preamble
        except:
            self.__field_preamble=sanyofaheader(**{'faset': 0x13})
        self.__field_preamble.writetobuffer(buf)
        try: self.__field_command
        except:
            self.__field_command=UINT(**{'sizeinbytes': 1, 'default': 0})
        self.__field_command.writetobuffer(buf)
        try: self.__field_packettype
        except:
            self.__field_packettype=UINT(**{'sizeinbytes': 1, 'default': 0})
        self.__field_packettype.writetobuffer(buf)
        self._bufferendoffset=buf.getcurrentoffset()
        if autolog and self._bufferstartoffset==0: self.autologwrite(buf, logtitle=logtitle)


    def readfrombuffer(self,buf,autolog=True,logtitle="<read data>"):
        'Reads this packet from the supplied buffer'
        self._bufferstartoffset=buf.getcurrentoffset()
        if autolog and self._bufferstartoffset==0: self.autologread(buf, logtitle=logtitle)
        self.__field_preamble=sanyofaheader(**{'faset': 0x13})
        self.__field_preamble.readfrombuffer(buf)
        self.__field_command=UINT(**{'sizeinbytes': 1, 'default': 0})
        self.__field_command.readfrombuffer(buf)
        self.__field_packettype=UINT(**{'sizeinbytes': 1, 'default': 0})
        self.__field_packettype.readfrombuffer(buf)
        self._bufferendoffset=buf.getcurrentoffset()


    def __getfield_preamble(self):
        try: self.__field_preamble
        except:
            self.__field_preamble=sanyofaheader(**{'faset': 0x13})
        return self.__field_preamble.getvalue()

    def __setfield_preamble(self, value):
        if isinstance(value,sanyofaheader):
            self.__field_preamble=value
        else:
            self.__field_preamble=sanyofaheader(value,**{'faset': 0x13})

    def __delfield_preamble(self): del self.__field_preamble

    preamble=property(__getfield_preamble, __setfield_preamble, __delfield_preamble, None)

    def __getfield_command(self):
        try: self.__field_command
        except:
            self.__field_command=UINT(**{'sizeinbytes': 1, 'default': 0})
        return self.__field_command.getvalue()

    def __setfield_command(self, value):
        if isinstance(value,UINT):
            self.__field_command=value
        else:
            self.__field_command=UINT(value,**{'sizeinbytes': 1, 'default': 0})

    def __delfield_command(self): del self.__field_command

    command=property(__getfield_command, __setfield_command, __delfield_command, None)

    def __getfield_packettype(self):
        try: self.__field_packettype
        except:
            self.__field_packettype=UINT(**{'sizeinbytes': 1, 'default': 0})
        return self.__field_packettype.getvalue()

    def __setfield_packettype(self, value):
        if isinstance(value,UINT):
            self.__field_packettype=value
        else:
            self.__field_packettype=UINT(value,**{'sizeinbytes': 1, 'default': 0})

    def __delfield_packettype(self): del self.__field_packettype

    packettype=property(__getfield_packettype, __setfield_packettype, __delfield_packettype, None)

    def iscontainer(self):
        return True

    def containerelements(self):
        yield ('preamble', self.__field_preamble, None)
        yield ('command', self.__field_command, None)
        yield ('packettype', self.__field_packettype, None)




class fastatusresponse(BaseProtogenClass):
    __fields=['preamble', 'status', 'packettype']

    def __init__(self, *args, **kwargs):
        dict={}
        # What was supplied to this function
        dict.update(kwargs)
        # Parent constructor
        super(fastatusresponse,self).__init__(**dict)
        if self.__class__ is fastatusresponse:
            self._update(args,dict)


    def getfields(self):
        return self.__fields


    def _update(self, args, kwargs):
        super(fastatusresponse,self)._update(args,kwargs)
        keys=kwargs.keys()
        for key in keys:
            if key in self.__fields:
                setattr(self, key, kwargs[key])
                del kwargs[key]
        # Were any unrecognized kwargs passed in?
        if __debug__:
            self._complainaboutunusedargs(fastatusresponse,kwargs)
        if len(args): raise TypeError('Unexpected arguments supplied: '+`args`)
        # Make all P fields that haven't already been constructed


    def writetobuffer(self,buf,autolog=True,logtitle="<written data>"):
        'Writes this packet to the supplied buffer'
        self._bufferstartoffset=buf.getcurrentoffset()
        try: self.__field_preamble
        except:
            self.__field_preamble=sanyofaheader()
        self.__field_preamble.writetobuffer(buf)
        self.__field_status.writetobuffer(buf)
        self.__field_packettype.writetobuffer(buf)
        self._bufferendoffset=buf.getcurrentoffset()
        if autolog and self._bufferstartoffset==0: self.autologwrite(buf, logtitle=logtitle)


    def readfrombuffer(self,buf,autolog=True,logtitle="<read data>"):
        'Reads this packet from the supplied buffer'
        self._bufferstartoffset=buf.getcurrentoffset()
        if autolog and self._bufferstartoffset==0: self.autologread(buf, logtitle=logtitle)
        self.__field_preamble=sanyofaheader()
        self.__field_preamble.readfrombuffer(buf)
        self.__field_status=UINT(**{'sizeinbytes': 1, 'default': 0})
        self.__field_status.readfrombuffer(buf)
        self.__field_packettype=UINT(**{'sizeinbytes': 1, 'default': 0})
        self.__field_packettype.readfrombuffer(buf)
        self._bufferendoffset=buf.getcurrentoffset()


    def __getfield_preamble(self):
        try: self.__field_preamble
        except:
            self.__field_preamble=sanyofaheader()
        return self.__field_preamble.getvalue()

    def __setfield_preamble(self, value):
        if isinstance(value,sanyofaheader):
            self.__field_preamble=value
        else:
            self.__field_preamble=sanyofaheader(value,)

    def __delfield_preamble(self): del self.__field_preamble

    preamble=property(__getfield_preamble, __setfield_preamble, __delfield_preamble, None)

    def __getfield_status(self):
        return self.__field_status.getvalue()

    def __setfield_status(self, value):
        if isinstance(value,UINT):
            self.__field_status=value
        else:
            self.__field_status=UINT(value,**{'sizeinbytes': 1, 'default': 0})

    def __delfield_status(self): del self.__field_status

    status=property(__getfield_status, __setfield_status, __delfield_status, None)

    def __getfield_packettype(self):
        return self.__field_packettype.getvalue()

    def __setfield_packettype(self, value):
        if isinstance(value,UINT):
            self.__field_packettype=value
        else:
            self.__field_packettype=UINT(value,**{'sizeinbytes': 1, 'default': 0})

    def __delfield_packettype(self): del self.__field_packettype

    packettype=property(__getfield_packettype, __setfield_packettype, __delfield_packettype, None)

    def iscontainer(self):
        return True

    def containerelements(self):
        yield ('preamble', self.__field_preamble, None)
        yield ('status', self.__field_status, None)
        yield ('packettype', self.__field_packettype, None)




class response(BaseProtogenClass):
    __fields=['pad']

    def __init__(self, *args, **kwargs):
        dict={}
        # What was supplied to this function
        dict.update(kwargs)
        # Parent constructor
        super(response,self).__init__(**dict)
        if self.__class__ is response:
            self._update(args,dict)


    def getfields(self):
        return self.__fields


    def _update(self, args, kwargs):
        super(response,self)._update(args,kwargs)
        keys=kwargs.keys()
        for key in keys:
            if key in self.__fields:
                setattr(self, key, kwargs[key])
                del kwargs[key]
        # Were any unrecognized kwargs passed in?
        if __debug__:
            self._complainaboutunusedargs(response,kwargs)
        if len(args):
            dict2={}
            dict2.update(kwargs)
            kwargs=dict2
            self.__field_pad=UNKNOWN(*args,**dict2)
        # Make all P fields that haven't already been constructed


    def writetobuffer(self,buf,autolog=True,logtitle="<written data>"):
        'Writes this packet to the supplied buffer'
        self._bufferstartoffset=buf.getcurrentoffset()
        self.__field_pad.writetobuffer(buf)
        self._bufferendoffset=buf.getcurrentoffset()
        if autolog and self._bufferstartoffset==0: self.autologwrite(buf, logtitle=logtitle)


    def readfrombuffer(self,buf,autolog=True,logtitle="<read data>"):
        'Reads this packet from the supplied buffer'
        self._bufferstartoffset=buf.getcurrentoffset()
        if autolog and self._bufferstartoffset==0: self.autologread(buf, logtitle=logtitle)
        self.__field_pad=UNKNOWN()
        self.__field_pad.readfrombuffer(buf)
        self._bufferendoffset=buf.getcurrentoffset()


    def __getfield_pad(self):
        return self.__field_pad.getvalue()

    def __setfield_pad(self, value):
        if isinstance(value,UNKNOWN):
            self.__field_pad=value
        else:
            self.__field_pad=UNKNOWN(value,)

    def __delfield_pad(self): del self.__field_pad

    pad=property(__getfield_pad, __setfield_pad, __delfield_pad, None)

    def iscontainer(self):
        return True

    def containerelements(self):
        yield ('pad', self.__field_pad, None)




