def set_memory(self, memory): if memory.number < 0 or memory.number > self._upper: raise errors.InvalidMemoryLocation( "Number must be between 0 and %i" % self._upper) spec = self._make_mem_spec(memory) spec = "".join(spec) r1 = command(self.pipe, *self._cmd_set_memory(memory.number, spec)) if not iserr(r1): memory.name = memory.name.rstrip() self._memcache[memory.number] = memory # if we're tuned to the channel, reload it r1 = command(self.pipe, *self._cmd_cur_memory(memory.number)) if not iserr(r1): pattern = re.compile("MC([0-9]{3})") match = pattern.search(r1) if match is not None: cur_mem = int(match.group(1)) if cur_mem == memory.number: cur_mem = \ command(self.pipe, *self._cmd_recall_memory(memory.number)) else: raise errors.InvalidDataError("Radio refused %i" % memory.number) # FIXME if memory.duplex == "split" and self._kenwood_split: spec = "".join(self._make_split_spec(memory)) result = command(self.pipe, *self._cmd_set_split(memory.number, spec)) if iserr(result): raise errors.InvalidDataError("Radio refused %i" % memory.number)
def set_memory(self, memory): if memory.number < 0 or memory.number > self._upper: raise errors.InvalidMemoryLocation("Number must be between 0 and %i" % self._upper) spec = self._make_mem_spec(memory) spec = "".join(spec) r1 = command(self.pipe, *self._cmd_set_memory(memory.number, spec)) if not iserr(r1): memory.name = memory.name.rstrip() self._memcache[memory.number] = memory # if we're tuned to the channel, reload it r1 = command(self.pipe, *self._cmd_cur_memory(memory.number)) if not iserr(r1): pattern = re.compile("MC([0-9]{3})") match = pattern.search(r1) if match is not None: cur_mem = int(match.group(1)) if cur_mem == memory.number: cur_mem = command(self.pipe, *self._cmd_recall_memory(memory.number)) else: raise errors.InvalidDataError("Radio refused %i" % memory.number) # FIXME if memory.duplex == "split" and self._kenwood_split: spec = "".join(self._make_split_spec(memory)) result = command(self.pipe, *self._cmd_set_split(memory.number, spec)) if iserr(result): raise errors.InvalidDataError("Radio refused %i" % memory.number)
def erase_memory(self, number): if number not in self._memcache: return resp = command(self.pipe, *self._cmd_erase_memory(number)) if iserr(resp): raise errors.RadioError("Radio refused delete of %i" % number) del self._memcache[number]
def set_memory(self, memory): if memory.number < 0 or memory.number > self._upper: raise errors.InvalidMemoryLocation( "Number must be between 0 and %i" % self._upper) if memory.number > 90: if memory.duplex == TS850_DUPLEX[0]: memory.duplex = TS850_DUPLEX[1] memory.offset = memory.freq else: if memory.freq > memory.offset: temp = memory.freq memory.freq = memory.offset memory.offset = temp # Clear out memory contents to prevent errors spec = self._make_base_spec(memory, 0) spec = "".join(spec) result = command(self.pipe, *self._cmd_set_memory(memory.number, spec)) if iserr(result): raise errors.InvalidDataError("Radio refused %i" % memory.number) # If we have a split set the transmit frequency first. if memory.duplex == TS850_DUPLEX[1]: spec = "".join(self._make_split_spec(memory)) result = command(self.pipe, *self._cmd_set_split(memory.number, spec)) if iserr(result): raise errors.InvalidDataError("Radio refused %i" % memory.number) spec = self._make_mem_spec(memory) spec = "".join(spec) result = command(self.pipe, *self._cmd_set_memory(memory.number, spec)) if iserr(result): raise errors.InvalidDataError("Radio refused %i" % memory.number)
def get_memory(self, number): if number < 0 or number > self._upper: raise errors.InvalidMemoryLocation("Number must be between 0 and %i" % self._upper) if number in self._memcache and not NOCACHE: return self._memcache[number] result = command(self.pipe, *self._cmd_get_memory(number)) if result == "N": mem = chirp_common.Memory() mem.number = number mem.empty = True self._memcache[mem.number] = mem return mem mem = self._parse_mem_spec(result) self._memcache[mem.number] = mem # check for split frequency operation if mem.duplex == "" and self._kenwood_split: result = command(self.pipe, *self._cmd_get_split(number)) self._parse_split_spec(mem, result) return mem
def get_memory(self, number): if number < 0 or number > self._upper: raise errors.InvalidMemoryLocation( "Number must be between 0 and %i" % self._upper) if number in self._memcache and not NOCACHE: return self._memcache[number] result = command(self.pipe, *self._cmd_get_memory(number)) if result == "N": mem = chirp_common.Memory() mem.number = number mem.empty = True self._memcache[mem.number] = mem return mem mem = self._parse_mem_spec(result) self._memcache[mem.number] = mem # check for split frequency operation if mem.duplex == "" and self._kenwood_split: result = command(self.pipe, *self._cmd_get_split(number)) self._parse_split_spec(mem, result) return mem