def _headers(self): f = PathManager.open_output_file( f'{radio_types.D710}/{radio_types.D710}.hmk', 'w+') headers = self._channels[1].headers() f.write(headers + "\n") f.close() pass
def _output(self): f = PathManager.open_output_file( f'{radio_types.D710}/{radio_types.D710}.hmk', 'a') channel_number = 1 for channel in self._channels: if channel.is_digital(): continue channel_data = channel.output(channel_number) f.writelines(channel_data + "\n") channel_number += 1 f.close()
def _output_user(self): if self._users is None: logging.error(f"No zones list found for {radio_types.DEFAULT}.") return writer = PathManager.open_output_file(f'{radio_types.DEFAULT}/{radio_types.DEFAULT}_user.csv', 'w+') users_file = csv.writer(writer, lineterminator='\n') headers = DmrUserDefault.create_empty() users_file.writerow(headers.headers()) for user in self._users.values(): casted_user = DmrUserBuilder.casted(user.cols, radio_types.DEFAULT) users_file.writerow(casted_user.output(None)) writer.close()
def _output_zones(self): if self._zones is None: logging.error(f"No zones list found for {radio_types.DEFAULT}.") return writer = PathManager.open_output_file(f'{radio_types.DEFAULT}/{radio_types.DEFAULT}_zone.csv', 'w+') zone_file = csv.writer(writer, lineterminator='\n') headers = RadioZoneDefault.create_empty() zone_file.writerow(headers.headers()) for zone in self._zones.values(): casted_zone = RadioZoneBuilder.casted(zone.cols, zone._associated_channels, radio_types.DEFAULT) zone_file.writerow(casted_zone.output()) writer.close()
def _output_contacts(self): if self._digital_contacts is None: logging.error(f"No digital contacts found for {radio_types.DEFAULT}.") return writer = PathManager.open_output_file(f'{radio_types.DEFAULT}/{radio_types.DEFAULT}_contacts.csv', 'w+') dmr_contact_file = csv.writer(writer, lineterminator='\n') headers = DmrContactDefault.create_empty() dmr_contact_file.writerow(headers.headers()) for dmr_contact in self._digital_contacts.values(): casted_contact = DmrContactBuilder.casted(dmr_contact, radio_types.DEFAULT) row_data = casted_contact.output(None) dmr_contact_file.writerow(row_data) writer.close()
def _output_radioids(self): if self._dmr_ids is None: logging.error(f"No DMR ids found for {radio_types.DEFAULT}.") return writer = PathManager.open_output_file(f'{radio_types.DEFAULT}/{radio_types.DEFAULT}_radioid.csv', 'w+') radio_id_file = csv.writer(writer, lineterminator='\n') headers = DmrIdDefault.create_empty() radio_id_file.writerow(headers.headers()) number = 1 for dmr_id in self._dmr_ids.values(): casted_id = DmrIdBuilder.casted(dmr_id, radio_types.DEFAULT) radio_id_file.writerow(casted_id.output(None)) number += 1 writer.close() return