Esempio n. 1
0
        private void LoadMessagesAndSignals()
        {
            ClearMessagesAndSignals();

            List <VehicleScapeAPI.Message> messages = VehicleScapeInterface.GetMessages();

            int signalCount = 0;

            foreach (VehicleScapeAPI.Message message in messages)
            {
                uint   arbID = VehicleScapeInterface.GetMessageArbIDByHandle(message.handle);
                string networkDescription = VehicleScapeInterface.GetNetworkDescriptionByHandle(message.networkHandle);
                string source             = networkDescription + " ($" + arbID + ")";

                ListViewItem newItem = AvailableChannelsListView.Items.Add(message.description);
                newItem.Tag = new TagMetadata(message.handle, TagMetadata.MetadataType.Message);
                newItem.SubItems.Add(source);
                newItem.SubItems.Add(networkDescription);
                newItem.SubItems.Add("Message");

                List <VehicleScapeAPI.Signal> signals = VehicleScapeInterface.GetSignals(message.handle);
                foreach (VehicleScapeAPI.Signal signal in signals)
                {
                    signalCount++;
                    source = networkDescription + " " + message.description + " ($" + arbID + ")";
                    ListViewItem signalItem = AvailableChannelsListView.Items.Add(signal.description);
                    signalItem.Tag = new TagMetadata(signal.handle, TagMetadata.MetadataType.Signal);
                    signalItem.SubItems.Add(source);
                    signalItem.SubItems.Add(networkDescription);
                    signalItem.SubItems.Add(VehicleScapeAPI.SignalTypeToString(signal.type));
                }
            }
            Log("Retrieved " + signalCount + " signal" + (signalCount != 1 ? "s" : "") + ".");
            Log("Retrieved " + messages.Count + " message" + (messages.Count != 1 ? "s" : "") + ".");
        }