Exemple #1
0
 private void initCodeplug()
 {
     allContacts  = new Contacts();
     allRXGroups  = new RXGroups();
     allScanLists = new ScanLists();
     allZones     = new Zones();
     allChannels  = new Channels();
 }
Exemple #2
0
        public String[] ToCSV(Contacts allContacts, RXGroups allRXGroups, ScanLists allScanLists, Zones allZones, bool withGUID)
        {
            int size = allChannels.Rows.Count + 1; //count + header line

            String[] allLines = new String[size];
            allLines [0] = "GUID;Mode;ChannelName;RxFreq;TxFreq;BW;ScnLst;Sql;RxRef;TxRef;TOT;Rekey;Power;Admit;AScn;RxOnly;Lone;VOX;ATA;Enc;Dec;QtRev;RxSig;TxSig;RBurst;PTTID;Dec1;Dec2;Dec3;Dec4;Dec5;Dec6;Dec7;Dec8;PCC;EAA;DCC;UDP;ESyst;Contact;GrpLst;Color;Priv;PrivNo;Slot";
            for (int i = 0; i < allChannels.Rows.Count; i++)
            {
                ChannelObject oneChannel = (ChannelObject)allChannels.Rows[i].ItemArray[CHANNEL];
                if (oneChannel.Mode.Mode == ChannelMode.ANALOG || oneChannel.Mode.Mode == ChannelMode.DIGITAL)
                {
                    allLines[i + 1] = oneChannel.ToString(allContacts, allRXGroups, allScanLists, allZones, withGUID);
                }
            }
            return(allLines);
        }
Exemple #3
0
 public void FromCSV(String[] csvData, Contacts allContacts, RXGroups allRXGroups, ScanLists allScanLists, Zones allZones, bool withGUID)
 {
     initDataTable();
     for (int i = 1; i < csvData.Length; i++) //skip line with index 0 - it's the header line
     {
         if (csvData[i].Length > 0)
         {
             ChannelObject oneChannel = new ChannelObject();
             oneChannel.SetDataFromCSV(csvData[i], allContacts, allRXGroups, allScanLists, allZones);
             if (Debug.GetInstance().DebugOn)
             {
                 Console.WriteLine("In:  " + csvData[i]);
                 Console.WriteLine("Out: " + oneChannel.ToString(allContacts, allRXGroups, allScanLists, allZones));
             }
             AddChannel(oneChannel);
         }
     }
 }
Exemple #4
0
        public String ToString(Contacts allContacts, RXGroups allRXGroups, ScanLists allScanLists, Zones allZones, bool withGUID)
        {
            StringBuilder sb = new StringBuilder();

            sb.Append(guid);
            sb.Append(";");
            sb.Append(mode);
            sb.Append(";");
            sb.Append(name);
            sb.Append(";");
            sb.Append(rxFreq);
            sb.Append(";");
            sb.Append(txFreq);
            sb.Append(";");
            sb.Append(bandwidth);
            sb.Append(";");
            //sb.Append(scanListId);
            if (withGUID)
            {
                sb.Append(scanListId > 0?allScanLists.getObjectById(scanListId).ScanListName:"None");
                sb.Append(";");
            }
            else
            {
                sb.Append(scanListId > 0?allScanLists.getObjectById(scanListId).ScanListName:"None");
                sb.Append(";");
            }
            sb.Append(squelch);
            sb.Append(";");
            sb.Append(rxRefFrequency);
            sb.Append(";");
            sb.Append(txRefFrequency);
            sb.Append(";");
            sb.Append(tot);
            sb.Append(";");
            sb.Append(rekeyDelay);
            sb.Append(";");
            sb.Append(power);
            sb.Append(";");
            sb.Append(admitCriteria);
            sb.Append(";");
            sb.Append(autoScan);
            sb.Append(";");
            sb.Append(rxOnly);
            sb.Append(";");
            sb.Append(loneWorker);
            sb.Append(";");
            sb.Append(vox);
            sb.Append(";");
            sb.Append(allowTalkAroung);
            sb.Append(";");
            sb.Append(encCTCSS);
            sb.Append(";");
            sb.Append(decCTCSS);
            sb.Append(";");
            sb.Append(qtReverse);
            sb.Append(";");
            sb.Append(rxSignalingSystem);
            sb.Append(";");
            sb.Append(txSignalingSystem);
            sb.Append(";");
            sb.Append(reverseBurst);
            sb.Append(";");
            sb.Append(displayPTTId);
            sb.Append(";");
            sb.Append(decode1);
            sb.Append(";");
            sb.Append(decode2);
            sb.Append(";");
            sb.Append(decode3);
            sb.Append(";");
            sb.Append(decode4);
            sb.Append(";");
            sb.Append(decode5);
            sb.Append(";");
            sb.Append(decode6);
            sb.Append(";");
            sb.Append(decode7);
            sb.Append(";");
            sb.Append(decode8);
            sb.Append(";");
            sb.Append(privateCallConfirmed);
            sb.Append(";");
            sb.Append(emergencyCallAck);
            sb.Append(";");
            sb.Append(dataCallConfirmed);
            sb.Append(";");
            sb.Append(compressedUPDHeader);
            sb.Append(";");
            sb.Append(emergencySystemId > 0?"Unknwon":"None");
            sb.Append(";");
            //sb.Append(contactId);
            if (withGUID)
            {
                sb.Append(contactId.Value > 0 ? allContacts.getObjectById(contactId.Value).GUID : "None");
                sb.Append(";");
            }
            else
            {
                sb.Append(contactId.Value > 0 ? allContacts.getObjectById(contactId.Value).ContactName : "None");
                sb.Append(";");
            }
            //sb.Append(groupListId);
            sb.Append(groupListId > 0?allRXGroups.getObjectById(groupListId).RXGroupName:"None");
            sb.Append(";");
            sb.Append(colorCode);
            sb.Append(";");
            sb.Append(privacy);
            sb.Append(";");
            sb.Append(privacyNo);
            sb.Append(";");
            sb.Append(repeaterSlot);

            return(sb.ToString());
        }
Exemple #5
0
 public String ToString(Contacts allContacts, RXGroups allRXGroups, ScanLists allScanLists, Zones allZones)
 {
     return(ToString(allContacts, allRXGroups, allScanLists, allZones, false));
 }
Exemple #6
0
 public void SetDataFromCSV(String csvData, Contacts allContacts, RXGroups allRXGroups, ScanLists allScanLists, Zones allZones, bool withGUID)
 {
     String[] allFields = csvData.Split(';');
     guid = allFields[_GUID];
     mode.fromString(allFields[_MODE]);
     name.Name = allFields[_NAME];
     rxFreq.FromString(allFields[_RXFREQ]);
     txFreq.FromString(allFields[_TXFREQ]);
     bandwidth.FromString(allFields[_BANDWIDTH]);
     if (withGUID)
     {
         scanListId = allScanLists.getIdByGUID(allFields[_SCANLISTID]);
     }
     else
     {
         scanListId = allScanLists.getIdByName(allFields[_SCANLISTID]);
     }
     squelch.FromString(allFields[_SQUELCH]);
     rxRefFrequency.FromString(allFields[_RXREFFREQUENCY]);
     txRefFrequency.FromString(allFields[_TXREFFREQUENCY]);
     tot.FromString(allFields[_TOT]);
     rekeyDelay = Int32.Parse(allFields[_REKEYDELAY]);
     power.FromString(allFields[_POWER]);
     admitCriteria.FromString(allFields[_ADMITCRITERIA]);
     autoScan.FromString(allFields[_AUTOSCAN]);
     rxOnly.FromString(allFields[_RXONLY]);
     loneWorker.FromString(allFields[_LONEWORKER]);
     vox.FromString(allFields[_VOX]);
     allowTalkAroung.FromString(allFields[_ALLOWTALKAROUNG]);
     encCTCSS.FromString(allFields[_ENCCTCSS]);
     decCTCSS.FromString(allFields[_DECCTCSS]);
     qtReverse.FromString(allFields[_QTREVERSE]);
     rxSignalingSystem.FromString(allFields[_RXSIGNALINGSYSTEM]);
     txSignalingSystem.FromString(allFields[_TXSIGNALINGSYSTEM]);
     reverseBurst.FromString(allFields[_REVERSEBURST]);
     displayPTTId.FromString(allFields[_DISPLAYPTTID]);
     decode1.FromString(allFields[_DECODE1]);
     decode2.FromString(allFields[_DECODE2]);
     decode3.FromString(allFields[_DECODE3]);
     decode4.FromString(allFields[_DECODE4]);
     decode5.FromString(allFields[_DECODE5]);
     decode6.FromString(allFields[_DECODE6]);
     decode7.FromString(allFields[_DECODE7]);
     decode8.FromString(allFields[_DECODE8]);
     privateCallConfirmed.FromString(allFields[_PRIVATECALLCONFIRMED]);
     emergencyCallAck.FromString(allFields[_EMERGENCYCALLACK]);
     dataCallConfirmed.FromString(allFields[_DATACALLCONFIRMED]);
     compressedUPDHeader.FromString(allFields[_COMPRESSEDUPDHEADER]);
     emergencySystemId = "None".Equals(allFields[_EMERGENCYSYSTEMID])?0:Int32.Parse(allFields[_EMERGENCYSYSTEMID]);
     if (withGUID)
     {
         contactId.Value = allContacts.getIdByGUID(allFields[_CONTACTID]);
     }
     else
     {
         contactId.Value = allContacts.getIdByName(allFields[_CONTACTID]);
     }
     groupListId = allRXGroups.getIdByName(allFields[_GROUPLISTID]);
     colorCode.FromString(allFields[_COLORCODE]);
     privacy.FromString(allFields[_PRIVACY]);
     privacyNo.FromString(allFields[_PRIVACYNO]);
     repeaterSlot.FromString(allFields[_REPEATERSLOT]);
 }
Exemple #7
0
 public void SetDataFromCSV(String csvData, Contacts allContacts, RXGroups allRXGroups, ScanLists allScanLists, Zones allZones)
 {
     SetDataFromCSV(csvData, allContacts, allRXGroups, allScanLists, allZones, false);
 }
Exemple #8
0
 public void FromCSV(String[] csvData, Contacts allContacts, RXGroups allRXGroups, ScanLists allScanLists, Zones allZones)
 {
     FromCSV(csvData, allContacts, allRXGroups, allScanLists, allZones);
 }