示例#1
0
        public MFTestResults HWObjectCreate()
        {

            if (Microsoft.SPOT.Hardware.SystemInfo.SystemID.SKU != 3)  //The Emulator on Windows Host
            {
                Log.Comment("Emulate Hardware test is restricted to emulator");
                return MFTestResults.Skip;
            }
            else
            {
                Log.Comment("EmulateHardware Object Test Starting");            
            }

            if (Microsoft.SPOT.Hardware.SystemInfo.SystemID.SKU != 3)
            {
                Log.Comment(" Emulator not detected - skipping");
                return MFTestResults.Skip;
            }
            HardwareClassList HW = new HardwareClassList();
            try
            {
                Log.Comment("Init hardware provider ");
                HW.InitializeHWProvider();
            }
            catch (Exception E)
            {
                Log.Comment(E.Message);
                return MFTestResults.Fail;
            }
            try
            {
                Log.Comment("Init Battery Class ");
                HW.InitializeBatteryClass();
            }

            catch (Exception E)
            {
                Log.Comment(E.Message);
                return MFTestResults.Fail;
            }
            try
            {
                Log.Comment("Init Port Class");
                HW.InitializePortClass();
            }
            catch (Exception E)
            {
                Log.Comment(E.Message);
                return MFTestResults.Fail;
            }

            try
            {
                Log.Comment("Init SPI Class");
                HW.InitializeSPI();
            }
            catch (Exception E)
            {
                Log.Comment(E.Message);
                return MFTestResults.Fail;
            }
            try
            {
                Log.Comment("Init I2C Class");
                HW.InitializeI2C();
            }
            catch (Exception E)
            {
                Log.Comment(E.Message);
                return MFTestResults.Fail;
            }
            try
            {
                Log.Comment("Init Serial Port");
                HW.InitializeSerial();
            }
            catch (Exception E)
            {
                Log.Comment(E.Message);
                return MFTestResults.Fail;
            }  
            try
            {
                Log.Comment("All HW classes created, now to be disposed");
                HW.Dispose();

            }
            catch (Exception E)
            {
                Log.Comment(E.Message);
                return MFTestResults.Fail;

            }
            return MFTestResults.Pass;
        } //HWObjectCreate
        public MFTestResults HWObjectCreate()
        {
            if (Microsoft.SPOT.Hardware.SystemInfo.SystemID.SKU != 3)  //The Emulator on Windows Host
            {
                Log.Comment("Emulate Hardware test is restricted to emulator");
                return(MFTestResults.Skip);
            }
            else
            {
                Log.Comment("EmulateHardware Object Test Starting");
            }

            if (Microsoft.SPOT.Hardware.SystemInfo.SystemID.SKU != 3)
            {
                Log.Comment(" Emulator not detected - skipping");
                return(MFTestResults.Skip);
            }
            HardwareClassList HW = new HardwareClassList();

            try
            {
                Log.Comment("Init hardware provider ");
                HW.InitializeHWProvider();
            }
            catch (Exception E)
            {
                Log.Comment(E.Message);
                return(MFTestResults.Fail);
            }
            try
            {
                Log.Comment("Init Battery Class ");
                HW.InitializeBatteryClass();
            }

            catch (Exception E)
            {
                Log.Comment(E.Message);
                return(MFTestResults.Fail);
            }
            try
            {
                Log.Comment("Init Port Class");
                HW.InitializePortClass();
            }
            catch (Exception E)
            {
                Log.Comment(E.Message);
                return(MFTestResults.Fail);
            }

            try
            {
                Log.Comment("Init SPI Class");
                HW.InitializeSPI();
            }
            catch (Exception E)
            {
                Log.Comment(E.Message);
                return(MFTestResults.Fail);
            }
            try
            {
                Log.Comment("Init I2C Class");
                HW.InitializeI2C();
            }
            catch (Exception E)
            {
                Log.Comment(E.Message);
                return(MFTestResults.Fail);
            }
            try
            {
                Log.Comment("Init Serial Port");
                HW.InitializeSerial();
            }
            catch (Exception E)
            {
                Log.Comment(E.Message);
                return(MFTestResults.Fail);
            }
            try
            {
                Log.Comment("All HW classes created, now to be disposed");
                HW.Dispose();
            }
            catch (Exception E)
            {
                Log.Comment(E.Message);
                return(MFTestResults.Fail);
            }
            return(MFTestResults.Pass);
        } //HWObjectCreate