def parseOA(self,buffer): length = sum(divmod(buffer.nextInt(f='OA Length'),2)) type = buffer.nextInt(f='OA Type') self.OAtype = (type >> 4) & 7 self.OAplan = type & 15 if self.OAtype == 5: self.OAnumber = decode_septets(buffer.next(length,f='OA')) elif self.OAtype == 1: self.OAnumber = "+" + decode_number(buffer.nextArray(length,f='OA')) else: self.OAnumber = decode_number(buffer.nextArray(length,f='OA'))
def parseSCAddress(self,buffer): length = buffer.nextInt(f="SCA Length") type = buffer.nextInt(f='SCA Type') self.SCtype = (type >> 4) & 7 self.SCplan = type & 15 if self.SCtype == 5: self.SCnumber = decode_septets(buffer.next(length-1,f='SCA')) elif self.SCtype == 1: self.SCnumber = "+" + decode_number(buffer.nextArray(length-1,f='SCA')) else: self.SCnumber = decode_number(buffer.nextArray(length-1,f='SCA'))
def parseUD(self, buffer): length = buffer.nextInt(f='UD Length') self.UD = buffer.remainder(f='UD') alphabet = self.DataCoding['alphabet'] if alphabet == 0: self.decoded = decode_septets(self.UD) elif alphabet == 1: self.decoded = self.UD.decode('hex') elif alphabet == 2: self.decoded = unicode(self.UD.decode('hex'), 'utf-16be') else: raise SMSException("Unsupported Alphabet - Reserved")
def parseOA(self, buffer): length = sum(divmod(buffer.nextInt(f='OA Length'), 2)) type = buffer.nextInt(f='OA Type') self.OAtype = (type >> 4) & 7 self.OAplan = type & 15 if self.OAtype == 5: self.OAnumber = decode_septets(buffer.next(length, f='OA')) elif self.OAtype == 1: self.OAnumber = "+" + decode_number( buffer.nextArray(length, f='OA')) else: self.OAnumber = decode_number(buffer.nextArray(length, f='OA'))
def parseUD(self,buffer): length = buffer.nextInt(f='UD Length') self.UD = buffer.remainder(f='UD') alphabet = self.DataCoding['alphabet'] if alphabet == 0: self.decoded = decode_septets(self.UD) elif alphabet == 1: self.decoded = self.UD.decode('hex') elif alphabet == 2: self.decoded = unicode(self.UD.decode('hex'),'utf-16be') else: raise SMSException("Unsupported Alphabet - Reserved")
def parseSCAddress(self, buffer): length = buffer.nextInt(f="SCA Length") type = buffer.nextInt(f='SCA Type') self.SCtype = (type >> 4) & 7 self.SCplan = type & 15 if self.SCtype == 5: self.SCnumber = decode_septets(buffer.next(length - 1, f='SCA')) elif self.SCtype == 1: self.SCnumber = "+" + decode_number( buffer.nextArray(length - 1, f='SCA')) else: self.SCnumber = decode_number(buffer.nextArray(length - 1, f='SCA'))