コード例 #1
0
        public byte[] RawDataFromChannels()
        {
            byte[] rawData   = new byte[DATA_WIDTH * MAX];
            int    tmpOffset = 0;

            for (int i = 0; i < allChannels.Rows.Count; i++)
            {
                ChannelObject oneChannel = (ChannelObject)allChannels.Rows[i].ItemArray[CHANNEL];
                Array.Copy(oneChannel.RawData, 0, rawData, tmpOffset, DATA_WIDTH);
                tmpOffset += DATA_WIDTH;
            }
            return(rawData);
        }
コード例 #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);
        }
コード例 #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);
         }
     }
 }
コード例 #4
0
        public void ChannelsFromRawData(byte[] rawData, bool debug)
        {
            initDataTable();
            int offset = OFFSET;

            for (int i = 0; i < MAX; i++)
            {
                String hex;
                byte[] oneChannelRaw = new byte[DATA_WIDTH];
                for (int j = 0; j < DATA_WIDTH; j++)
                {
                    byte value = rawData[offset + j];
                    oneChannelRaw[j] = value;
                    if (debug)
                    {
                        hex = string.Format("{0:X2}", value);
                        Console.Write(hex + " ");
                    }
                }
                if (debug)
                {
                    Console.WriteLine();
                }
                offset += DATA_WIDTH;
                ChannelObject ch = new ChannelObject();
                ch.RawData = oneChannelRaw;
                AddChannel(ch);
                if (debug)
                {
                    Console.WriteLine(ch.ToString());
                    oneChannelRaw = ch.RawData;
                    for (int j = 0; j < DATA_WIDTH; j++)
                    {
                        byte value = oneChannelRaw[j];
                        hex = string.Format("{0:X2}", value);
                        Console.Write(hex + " ");
                    }
                    Console.WriteLine();
                }
            }
        }
コード例 #5
0
 public void AddChannel(ChannelObject oneChannel)
 {
     allChannels.Rows.Add(oneChannel.GUID, oneChannel.Name, oneChannel);
 }