コード例 #1
0
        private static void ConfigureVirtualPowerSensor()
        {
            System.Threading.Thread.Sleep(500);    // Delay 500ms after a reset

            Console.WriteLine("Setting network key...");
            if (device0.setNetworkKey(USER_NETWORK_NUM_POWER, USER_NETWORK_KEY, 500))
            {
                Console.WriteLine("Network key set");
            }
            else
            {
                throw new Exception("Error configuring network key");
            }

            Console.WriteLine("Setting Channel ID...");
            if (channel2.setChannelID(USER_DEVICENUM, false, USER_DEVICETYPE_POWER, USER_TRANSTYPE, 500))  // Not using pairing bit
            {
                Console.WriteLine("Channel ID set");
            }
            else
            {
                throw new Exception("Error configuring Channel ID");
            }

            virtualPowerSensor = new BikePowerOnlySensor(channel2, network);
            virtualPowerSensor.TurnOn();
        }
コード例 #2
0
        private static void ConfigureANT()
        {
            Console.WriteLine("Resetting module 0 ...");
            device0.ResetSystem();
            System.Threading.Thread.Sleep(500);

            Console.WriteLine("Setting network key...");
            if (device0.setNetworkKey(USER_NETWORK_NUM, USER_NETWORK_KEY, 500))
            {
                Console.WriteLine("Network key set");
            }
            else
            {
                throw new Exception("Error configuring network key");
            }

            Console.WriteLine("Setting Channel ID...");
            if (channel0.setChannelID(1, false, 17, 0, 8192))
            {
                Console.WriteLine("Channel ID set");
            }
            else
            {
                throw new Exception("Error configuring Channel ID");
            }

            Console.WriteLine("Setting Channel ID...");
            if (channel1.setChannelID(1, false, 11, 5, 8182))
            {
                Console.WriteLine("Channel ID set");
            }
            else
            {
                throw new Exception("Error configuring Channel ID");
            }

            fitnessEquipmentDisplay = new FitnessEquipmentDisplay(channel0, networkAntPlus);
            fitnessEquipmentDisplay.SpecificTrainerPageReceived += FitnessEquipmentDisplay_SpecificTrainerPage;
            fitnessEquipmentDisplay.TurnOn();

            bikePowerOnlySensor = new BikePowerOnlySensor(channel1, networkAntPlus);
            bikePowerOnlySensor.TurnOn();
        }