示例#1
0
 internal XBeePro900HP(XBeeControllerBase controller,
                       HardwareVersion hardwareVersion,
                       ushort firmwareVersion,
                       XBeeProtocol protocol,
                       NodeAddress address = null) : base(controller, hardwareVersion, firmwareVersion, protocol, address)
 {
 }
示例#2
0
        private XBeeNode CreateNode(HardwareVersion hardwareVersion, NodeAddress address = null)
        {
            switch (hardwareVersion)
            {
            case HardwareVersion.XBeeSeries1:
                return(new XBeeSeries1(this, HardwareVersion.XBeeSeries1, address));

            case HardwareVersion.XBeeProSeries1:
                return(new XBeeSeries1(this, HardwareVersion.XBeeProSeries1, address));

            case HardwareVersion.XBeeProS2:
                return(new XBeeSeries2(this, HardwareVersion.XBeeProS2, address));

            case HardwareVersion.XBeeProS2B:
                return(new XBeeSeries2(this, HardwareVersion.XBeeProS2B, address));

            case HardwareVersion.XBeePro900:
                return(new XBeePro900HP(this, HardwareVersion.XBeePro900, address));

            case HardwareVersion.XBeePro900HP:
                return(new XBeePro900HP(this, HardwareVersion.XBeePro900HP, address));

            default:
                throw new NotSupportedException($"{hardwareVersion} not supported.");
            }
        }
示例#3
0
 internal XBeeSeries1(XBeeControllerBase controller,
                      HardwareVersion hardwareVersion = HardwareVersion.XBeeSeries1,
                      ushort firmwareVersion          = 0,
                      XBeeProtocol protocol           = XBeeProtocol.Unknown,
                      NodeAddress address             = null) : base(controller, hardwareVersion, firmwareVersion, protocol, address)
 {
 }
示例#4
0
 public XBeeCellular(XBeeControllerBase controller,
                     HardwareVersion hardwareVersion,
                     ushort firmwareVersion,
                     XBeeProtocol protocol,
                     NodeAddress address = null)
     : base(controller, hardwareVersion, firmwareVersion, protocol, address)
 {
 }
示例#5
0
        public static DeviceSeries GetSeries(HardwareVersion hardwareVersion)
        {
            if (!Series.TryGetValue(hardwareVersion, out var series))
            {
                throw new NotSupportedException($"Hardware version {hardwareVersion} not supported.");
            }

            return(series);
        }
示例#6
0
        internal XBeeNode(XBeeController controller, HardwareVersion hardwareVersion, NodeAddress address = null)
        {
            Controller      = controller;
            HardwareVersion = hardwareVersion;
            Address         = address;

            Controller.SampleReceived += ControllerOnSampleReceived;
            Controller.DataReceived   += ControllerOnDataReceived;
        }
示例#7
0
 private static void WriteVersion(BinaryWriter file, HardwareVersion v)
 {
     file.Write(Encoding.ASCII.GetBytes($"device-version-audio: {v.Audio}\n"));
     file.Write(Encoding.ASCII.GetBytes($"device-version-depth: {v.Depth}\n"));
     file.Write(Encoding.ASCII.GetBytes($"device-version-depth-sensor: {v.DepthSensor}\n"));
     file.Write(Encoding.ASCII.GetBytes($"device-version-firmware-build: {v.FirmwareBuild}\n"));
     file.Write(Encoding.ASCII.GetBytes($"device-version-firmware-signature: {v.FirmwareSignature}\n"));
     file.Write(Encoding.ASCII.GetBytes($"device-version-rgb: {v.RGB}\n"));
 }
示例#8
0
 /// <summary>
 /// Computes the hash code for the current metadata object.
 /// </summary>
 /// <returns>
 /// The hash code for the current metadata object, extracted from a combination
 /// of hashes for the device name and various version numbers.
 /// </returns>
 public override int GetHashCode()
 {
     return(17 * DeviceName.GetHashCode() +
            8971 * FirmwareVersion.GetHashCode() +
            2803 * ProtocolVersion.GetHashCode() +
            691 * HardwareVersion.GetHashCode() +
            1409 * AssemblyNumber.GetHashCode() +
            2333 * PrereleaseVersion.GetHashCode());
 }
        public XBeeControllerViewModel(Universal.XBeeController controller, HardwareVersion hardwareVersion, bool isCoordinator)
        {
            Controller      = controller;
            HardwareVersion = hardwareVersion;
            IsCoordinator   = isCoordinator;

            controller.NodeDiscovered += ControllerOnNodeDiscovered;

            DiscoverCommand = new RelayCommand(Discover);
        }
示例#10
0
        public static void Init()
        {
            globals = new iOSGlobals();
            int scaleFactor = (int)(UIScreen.MainScreen.Scale * 100);

            globals.ResolutionScale = (ResolutionScale)scaleFactor;
            if (UIScreen.MainScreen.RespondsToSelector(new Selector("nativeBounds")))
            {
                if (globals.ResolutionScale == ResolutionScale.Scale300Percent &&
                    Runtime.Arch == Arch.DEVICE &&
                    UIScreen.MainScreen.NativeBounds.Width == 1080)
                {                 // for iPhone 6 Plus
                    globals.ScreenHeight = (double)UIScreen.MainScreen.NativeBounds.Height * 1.15;
                    globals.ScreenWidth  = (double)UIScreen.MainScreen.NativeBounds.Width * 1.15;
                }
                else
                {
                    globals.ScreenHeight = (double)UIScreen.MainScreen.NativeBounds.Height;
                    globals.ScreenWidth  = (double)UIScreen.MainScreen.NativeBounds.Width;
                }
            }
            else
            {
                globals.ScreenHeight = (double)(UIScreen.MainScreen.Bounds.Height * UIScreen.MainScreen.Scale);
                globals.ScreenWidth  = (double)(UIScreen.MainScreen.Bounds.Width * UIScreen.MainScreen.Scale);
            }

            string appName = (NSString)NSBundle.MainBundle.InfoDictionary.ObjectForKey(new NSString("CFBundleName"));

            globals.ApplicationName = appName;
            string version = (NSString)NSBundle.MainBundle.InfoDictionary.ObjectForKey(new NSString("CFBundleShortVersionString"));

            globals.Version = new System.Version(string.IsNullOrEmpty(version) ? "0.0.1" : version);
            string bundleName = (NSString)NSBundle.MainBundle.BundleIdentifier;

            globals.PackageName  = bundleName;
            globals.OSVersion    = UIDevice.CurrentDevice.SystemName + " " + UIDevice.CurrentDevice.SystemVersion;
            globals.Build        = DeviceHardware.Version;
            Version              = DeviceHardware.GetHardwareVersion(globals.Build);
            globals.Model        = DeviceHardware.GetDisplayVersion(Version, globals.Build);
            globals.Manufacturer = "Apple";
            globals.UserAgent    = string.Format("{0}/{1} ({2}; {3}/{4})", globals.ApplicationName,
                                                 globals.Version, globals.OSVersion, globals.Model, globals.Build);

            globals.DocumentsFolder = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal);
            globals.LibraryFolder   = System.IO.Path.Combine(globals.DocumentsFolder, "..", "Library");
            globals.CountryCode     = GetCountryCode();

            Globals.SetGlobals(globals);

            RegisterDependencies();

            // Force setting of default language.
            var lng = Globals.Language;
        }
示例#11
0
文件: XBeeNode.cs 项目: alamus/XBee
        internal XBeeNode(XBeeControllerBase controller, HardwareVersion hardwareVersion, ushort firmwareVersion, XBeeProtocol protocol, NodeAddress address = null)
        {
            Controller      = controller;
            HardwareVersion = hardwareVersion;
            FirmwareVersion = firmwareVersion;
            Protocol        = protocol;
            Address         = address;

            Controller.DataReceived         += ControllerOnDataReceived;
            Controller.SampleReceived       += ControllerOnSampleReceived;
            Controller.SensorSampleReceived += ControllerOnSensorSampleReceived;
        }
示例#12
0
 /// <summary>
 /// Determines whether the specified metadata object is equal to the current metadata.
 /// </summary>
 /// <param name="other">The metadata object to compare with the current metadata.</param>
 /// <returns>
 /// <b>true</b> if the specified metadata object is equal to the current metadata;
 /// otherwise, <b>false</b>.
 /// </returns>
 public bool Equals(FirmwareMetadata other)
 {
     if (other is null)
     {
         return(false);
     }
     return(DeviceName == other.DeviceName &&
            FirmwareVersion.Equals(other.FirmwareVersion) &&
            ProtocolVersion.Equals(other.ProtocolVersion) &&
            HardwareVersion.Equals(other.HardwareVersion) &&
            AssemblyNumber == other.AssemblyNumber &&
            PrereleaseVersion == other.PrereleaseVersion);
 }
        public void Initialize()
        {
            //
            if (Scene != null)
            {
                return;
            }


            var scene = CreateDefaultScene();

            this.Scene = scene;


            HardwareVersion ver     = Core.HardwareVersion;
            SimulationType  simType = this.Scene.SimulationType;
        }
示例#14
0
        public override bool FinishedLaunching(UIApplication application, NSDictionary launcOptions)
        {
            RectangleF bounds = UIScreen.MainScreen.Bounds.ToRectangleF();

            window = new UIWindow(bounds);
            window.RootViewController = new GenericViewController();
            window.MakeKeyAndVisible();

            UIApplication.SharedApplication.StatusBarHidden = true;

            Instance = this;

            HardwareVersion hardware = HardwareDetection.Version;

            context = Utilities.CreateGraphicsContext(EAGLRenderingAPI.OpenGLES1);

            glView = new EAGLView(bounds);
            GameBase.ScaleFactor = (float)UIScreen.MainScreen.Scale;

            window.AddSubview(glView);

            if (HardwareDetection.RunningiOS8OrHigher)
            {
                GameBase.NativeSize = new Size((int)(bounds.Width * GameBase.ScaleFactor), (int)(bounds.Height * GameBase.ScaleFactor));
            }
            else
            {
                GameBase.NativeSize = new Size((int)(bounds.Height * GameBase.ScaleFactor), (int)(bounds.Width * GameBase.ScaleFactor));
            }

#if !DIST
            Console.WriteLine("scale factor " + GameBase.ScaleFactor);
            Console.WriteLine("native size " + GameBase.NativeSize);
#endif
            GameBase.TriggerLayoutChanged();

            game.Initialize();
            glView.Run(game);

            UIDevice.CurrentDevice.BeginGeneratingDeviceOrientationNotifications();
            NSNotificationCenter.DefaultCenter.AddObserver(UIDevice.OrientationDidChangeNotification, RotationChanged);

            return(true);
        }
示例#15
0
        public void InitalizePhysics()
        {
            // Construct engine objects
            this.Camera = new Camera(this);

            //_visualizationEffect = new BasicEffect(this.Device)
            //{
            //    VertexColorEnabled = true
            //};
            //_vertexDeclaration = VertexPositionColor.VertexDeclaration;

            // Construct physics objects
            CoreDescription coreDesc = new CoreDescription();
            UserOutput      output   = new UserOutput();

            this.Core = new Core(coreDesc, output);

            Core core = this.Core;

            core.SetParameter(PhysicsParameter.VisualizationScale, 2.0f);
            core.SetParameter(PhysicsParameter.VisualizeCollisionShapes, true);
            core.SetParameter(PhysicsParameter.VisualizeClothMesh, true);
            core.SetParameter(PhysicsParameter.VisualizeJointLocalAxes, true);
            core.SetParameter(PhysicsParameter.VisualizeJointLimits, true);
            core.SetParameter(PhysicsParameter.VisualizeFluidPosition, true);
            core.SetParameter(PhysicsParameter.VisualizeFluidEmitters, false);             // Slows down rendering a bit too much
            core.SetParameter(PhysicsParameter.VisualizeForceFields, true);
            core.SetParameter(PhysicsParameter.VisualizeSoftBodyMesh, true);

            SceneDescription sceneDesc = new SceneDescription()
            {
                //SimulationType = SimulationType.Hardware,
                Gravity            = new Vector3(0, -9.81f, 0).AsPhysX(),
                GroundPlaneEnabled = true
            };

            this.Scene = core.CreateScene(sceneDesc);

            HardwareVersion ver     = Core.HardwareVersion;
            SimulationType  simType = this.Scene.SimulationType;

            // Connect to the remote debugger if it's there
            core.Foundation.RemoteDebugger.Connect("localhost");
        }
示例#16
0
        /// <summary>
        /// 物理ワールドの初期化
        /// </summary>
        public void init(CollisionDispatcher d, IBroadphaseInterface b, IConstraintSolver s, ICollisionConfiguration c)
        {
            // Construct physics objects
            CoreDescription coreDesc = new CoreDescription();
            UserOutput      output   = new UserOutput();

            this.Core = new Core(coreDesc, output);

            Core core = this.Core;

            // デバッグ描画用の設定
            core.SetParameter(PhysicsParameter.VisualizationScale, 2.0f);
            core.SetParameter(PhysicsParameter.VisualizeForceFields, true);
            core.SetParameter(PhysicsParameter.VisualizeCollisionShapes, true);
            core.SetParameter(PhysicsParameter.VisualizeJointLimits, true);

            /*
             * core.SetParameter(PhysicsParameter.VisualizeJointLocalAxes, true);
             * //core.SetParameter(PhysicsParameter.VisualizeJointWorldAxes, true);
             *          core.SetParameter(PhysicsParameter.VisualizeClothMesh, true);
             *          core.SetParameter(PhysicsParameter.VisualizeFluidPosition, true);
             *          core.SetParameter(PhysicsParameter.VisualizeFluidEmitters, false); // Slows down rendering a bit too much
             *          core.SetParameter(PhysicsParameter.VisualizeSoftBodyMesh, true);
             */

            // シーンの設定
            SceneDescription sceneDesc = new SceneDescription()
            {
                //SimulationType = SimulationType.Hardware,
                Gravity            = new Vector3(0, -9.81f, 0),
                GroundPlaneEnabled = true
            };

            this.scene = core.CreateScene(sceneDesc);

            HardwareVersion ver     = Core.HardwareVersion;
            SimulationType  simType = this.scene.SimulationType;

            // Connect to the remote debugger if it's there
            //core.Foundation.RemoteDebugger.Connect("localhost");
        }
示例#17
0
        public override void Initialize()
        {
            this.Camera = new Camera(this);

            _visualizationEffect = new BasicEffect(this.Device, null);

            _visualizationEffect.VertexColorEnabled = true;

            //

            CoreDescription coreDesc = new CoreDescription();
            UserOutput      output   = new UserOutput();

            this.Core = new Core(coreDesc, output);

            Core core = this.Core;

            core.SetParameter(PhysicsParameter.VisualizationScale, 2.0f);
            core.SetParameter(PhysicsParameter.VisualizeCollisionShapes, true);
            core.SetParameter(PhysicsParameter.VisualizeClothMesh, true);
            core.SetParameter(PhysicsParameter.VisualizeJointLocalAxes, true);
            core.SetParameter(PhysicsParameter.VisualizeJointLimits, true);
            core.SetParameter(PhysicsParameter.VisualizeFluidPosition, true);
            core.SetParameter(PhysicsParameter.VisualizeFluidEmitters, false); // Slows down rendering a bit to much
            core.SetParameter(PhysicsParameter.VisualizeForceFields, true);
            core.SetParameter(PhysicsParameter.VisualizeSoftBodyMesh, true);

            SceneDescription sceneDesc = new SceneDescription();

            //SimulationType = SimulationType.Hardware,
            sceneDesc.Gravity            = new Vector3(0.0f, -9.81f, 0.0f);
            sceneDesc.GroundPlaneEnabled = true;

            this.Scene = core.CreateScene(sceneDesc);

            HardwareVersion ver     = Core.HardwareVersion;
            SimulationType  simType = this.Scene.SimulationType;

            // Connect to the remote debugger if its there
            core.Foundation.RemoteDebugger.Connect("localhost");
        }
示例#18
0
        private IConnection CreateConnection(
            IPAddress ipAddress,
            ushort portNo,
            HardwareVersion requiredVersion)
        {
            IConnection connection = this._factory.CreateConnection(ipAddress, portNo);

            if (this._dictionary.ContainsValue(connection))
            {
                throw new InvalidOperationException("VisionSensor with designated address is already created.");
            }
            if (!connection.Connect())
            {
                throw new ConnectionLostException("Connection Failed.");
            }
            if (!this.CheckHardwareVersion((byte)requiredVersion))
            {
                throw new ConnectionLostException("Connection Failed.");
            }
            return(connection);
        }
示例#19
0
        private XBeeNode CreateNode(HardwareVersion hardwareVersion, NodeAddress address = null)
        {
            switch (hardwareVersion)
            {
            case Frames.AtCommands.HardwareVersion.XBeeSeries1:
                return(new XBeeSeries1(this, Frames.AtCommands.HardwareVersion.XBeeSeries1, address));

            case Frames.AtCommands.HardwareVersion.XBeeProSeries1:
                return(new XBeeSeries1(this, Frames.AtCommands.HardwareVersion.XBeeProSeries1, address));

            case Frames.AtCommands.HardwareVersion.ZNetZigBeeS2:
                return(new XBeeSeries2(this, Frames.AtCommands.HardwareVersion.ZNetZigBeeS2, address));

            case Frames.AtCommands.HardwareVersion.XBeeProS2:
                return(new XBeeSeries2(this, Frames.AtCommands.HardwareVersion.XBeeProS2, address));

            case Frames.AtCommands.HardwareVersion.XBeeProS2B:
                return(new XBeeSeries2(this, Frames.AtCommands.HardwareVersion.XBeeProS2B, address));

            case Frames.AtCommands.HardwareVersion.XBee24C:
                return(new XBeeSeries2(this, Frames.AtCommands.HardwareVersion.XBee24C, address));

            case Frames.AtCommands.HardwareVersion.XBeePro900:
                return(new XBeePro900HP(this, Frames.AtCommands.HardwareVersion.XBeePro900, address));

            case Frames.AtCommands.HardwareVersion.XBeePro900HP:
                return(new XBeePro900HP(this, Frames.AtCommands.HardwareVersion.XBeePro900HP, address));

            case Frames.AtCommands.HardwareVersion.XBeeProSX:
                return(new XBeePro900HP(this, Frames.AtCommands.HardwareVersion.XBeeProSX, address));

            case Frames.AtCommands.HardwareVersion.XBeeCellular:
                return(new XBeeCellular(this, Frames.AtCommands.HardwareVersion.XBeeCellular, address));

            default:
                throw new NotSupportedException($"{hardwareVersion} not supported.");
            }
        }
示例#20
0
        public static XBeeNode CreateDevice(HardwareVersion hardwareVersion, ushort firmwareVersion, NodeAddress address, XBeeControllerBase controller)
        {
            var series   = GetSeries(hardwareVersion);
            var protocol = GetProtocol(hardwareVersion, firmwareVersion);

            switch (series)
            {
            case DeviceSeries.Series1:
                return(new XBeeSeries1(controller, hardwareVersion, firmwareVersion, protocol, address));

            case DeviceSeries.Series2:
                return(new XBeeSeries2(controller, hardwareVersion, firmwareVersion, protocol, address));

            case DeviceSeries.Pro900:
                return(new XBeePro900HP(controller, hardwareVersion, firmwareVersion, protocol, address));

            case DeviceSeries.Cellular:
                return(new XBeeCellular(controller, hardwareVersion, firmwareVersion, protocol, address));

            default:
                throw new InvalidOperationException();
            }
        }
示例#21
0
        /// <summary>
        /// Return a JSON representation of this object.
        /// </summary>
        /// <param name="CustomEnergyMeterSerializer">A delegate to serialize custom energy meter JSON objects.</param>
        public JObject ToJSON(CustomJObjectSerializerDelegate <EnergyMeter> CustomEnergyMeterSerializer = null)
        {
            var JSON = JSONObject.Create(

                new JProperty("id", Id.ToString()),

                Model.IsNotNullOrEmpty()
                               ? new JProperty("model", Model.ToString())
                               : null,

                HardwareVersion.IsNotNullOrEmpty()
                               ? new JProperty("hardware_version", HardwareVersion.ToString())
                               : null,

                FirmwareVersion.IsNotNullOrEmpty()
                               ? new JProperty("firmware_version", FirmwareVersion.ToString())
                               : null,

                Vendor.IsNotNullOrEmpty()
                               ? new JProperty("vendor", Vendor.ToString())
                               : null,

                PublicKey.HasValue
                               ? new JProperty("public_key", PublicKey.ToString())
                               : null,

                PublicKeyCertificate.IsNotNullOrEmpty()
                               ? new JProperty("public_key_certificate", PublicKeyCertificate.ToString())
                               : null

                );

            return(CustomEnergyMeterSerializer != null
                       ? CustomEnergyMeterSerializer(this, JSON)
                       : JSON);
        }
示例#22
0
 internal XBeePro900HP(XBeeController controller,
                       HardwareVersion hardwareVersion = HardwareVersion.XBeePro900HP,
                       NodeAddress address             = null) : base(controller, hardwareVersion, address)
 {
 }
示例#23
0
 /// <summary>
 ///     Create a node.
 /// </summary>
 /// <param name="address">The address of the node or null for the controller node.</param>
 /// <param name="version">The hardware version to use for the specified node.</param>
 /// <param name="protocol">The protocol to use or null for default.</param>
 /// <returns>The specified node.</returns>
 public Task <XBeeNode> GetNodeAsync(NodeAddress address, HardwareVersion version, XBeeProtocol protocol = XBeeProtocol.Unknown)
 {
     return(Task.FromResult(CreateNode(version, 0, address)));
 }
示例#24
0
 private XBeeNode CreateNode(HardwareVersion hardwareVersion, ushort firmwareVersion, NodeAddress address = null)
 {
     return(DeviceFactory.CreateDevice(hardwareVersion, firmwareVersion, address, this));
 }
		/**
		 * Reads some parameters from this device and obtains its protocol.
		 * 
		 * <p>This method refresh the values of:</p>
		 * <ul>
		 * <li>64-bit address only if it is not initialized.</li>
		 * <li>Node Identifier.</li>
		 * <li>Hardware version if it is not initialized.</li>
		 * <li>Firmware version.</li>
		 * <li>XBee device protocol.</li>
		 * <li>16-bit address (not for DigiMesh modules).</li>
		 * </ul>
		 * 
		 * @throws InterfaceNotOpenException if this device connection is not open.
		 * @throws TimeoutException if there is a timeout reading the parameters.
		 * @throws XBeeException if there is any other XBee related exception.
		 * 
		 * @see #get16BitAddress()
		 * @see #get64BitAddress()
		 * @see #getHardwareVersion()
		 * @see #getNodeID()
		 * @see #getFirmwareVersion()
		 * @see #getXBeeProtocol()
		 * @see #setNodeID(String)
		 */
		public void readDeviceInfo() /*throws TimeoutException, XBeeException*/ {
			byte[] response = null;
			// Get the 64-bit address.
			if (xbee64BitAddress == null || xbee64BitAddress == XBee64BitAddress.UNKNOWN_ADDRESS)
			{
				String addressHigh;
				String addressLow;

				response = GetParameter("SH");
				addressHigh = HexUtils.ByteArrayToHexString(response);

				response = GetParameter("SL");
				addressLow = HexUtils.ByteArrayToHexString(response);

				while (addressLow.Length < 8)
					addressLow = "0" + addressLow;

				xbee64BitAddress = new XBee64BitAddress(addressHigh + addressLow);
			}
			// Get the Node ID.
			response = GetParameter("NI");
			nodeID = Encoding.UTF8.GetString(response);

			// Get the hardware version.
			if (hardwareVersion == null)
			{
				response = GetParameter("HV");
				hardwareVersion = HardwareVersion.Get(response[0]);
			}
			// Get the firmware version.
			response = GetParameter("VR");
			firmwareVersion = HexUtils.ByteArrayToHexString(response);

			// Obtain the device protocol.
			XBeeProtocol = XBeeProtocol.UNKNOWN.DetermineProtocol(hardwareVersion, firmwareVersion);

			// Get the 16-bit address. This must be done after obtaining the protocol because 
			// DigiMesh and Point-to-Multipoint protocols don't have 16-bit addresses.
			if (XBeeProtocol != XBeeProtocol.DIGI_MESH
					&& XBeeProtocol != XBeeProtocol.DIGI_POINT)
			{
				response = GetParameter("MY");
				xbee16BitAddress = new XBee16BitAddress(response);
			}
		}
示例#26
0
 public XBeeCellular(XBeeController controller, HardwareVersion hardwareVersion, NodeAddress address = null)
     : base(controller, hardwareVersion, address)
 {
 }
示例#27
0
 /// <summary>
 /// Returns whether the firmware supports the specified hardware version
 /// and board assembly number.
 /// </summary>
 /// <param name="deviceName">The identifier of the device to check for compatibility.</param>
 /// <param name="hardwareVersion">The hardware version to check for compatibility.</param>
 /// <param name="assemblyNumber">The optional board assembly number to check for compatibility.</param>
 /// <returns>
 /// <b>true</b> if the firmware supports the specified <paramref name="hardwareVersion"/> and
 /// <paramref name="assemblyNumber"/>; otherwise, <b>false</b>.
 /// </returns>
 public bool Supports(string deviceName, HarpVersion hardwareVersion, int assemblyNumber = default)
 {
     return(DeviceName == deviceName &&
            HardwareVersion.Satisfies(hardwareVersion) &&
            (!AssemblyNumber.HasValue || AssemblyNumber.Value == assemblyNumber));
 }
示例#28
0
        public static HardwareVersion GetHardwareVersion(string version)
        {
            HardwareVersion ret = HardwareVersion.Unknown;

            switch (version)
            {
            case "iPhone1,1":
                ret = HardwareVersion.iPhone;
                break;

            case "iPhone1,2":
                ret = HardwareVersion.iPhone3G;
                break;

            case "iPhone2,1":
                ret = HardwareVersion.iPhone3GS;
                break;

            case "iPhone3,1":
            case "iPhone3,2":
            case "iPhone3,3":
                ret = HardwareVersion.iPhone4;
                break;

            case "iPhone4,1":
                ret = HardwareVersion.iPhone4S;
                break;

            case "iPhone5,1":
            case "iPhone5,2":
                ret = HardwareVersion.iPhone5;
                break;

            case "iPhone5,3":
            case "iPhone5,4":
                ret = HardwareVersion.iPhone5C;
                break;

            case "iPhone6,1":
            case "iPhone6,2":
                ret = HardwareVersion.iPhone5S;
                break;

            case "iPhone7,2":
                ret = HardwareVersion.iPhone6;
                break;

            case "iPhone7,1":
                ret = HardwareVersion.iPhone6Plus;
                break;

            case "iPhone8,1":
                ret = HardwareVersion.iPhone6S;
                break;

            case "iPhone8,2":
                ret = HardwareVersion.iPhone6SPlus;
                break;

            case "iPhone8,4":
                ret = HardwareVersion.iPhoneSE;
                break;

            case "iPhone9,1":
            case "iPhone9,3":
                ret = HardwareVersion.iPhone7;
                break;

            case "iPhone9,2":
            case "iPhone9,4":
                ret = HardwareVersion.iPhone7Plus;
                break;

            case "iPhone10,1":
            case "iPhone10,4":
                ret = HardwareVersion.iPhone8;
                break;

            case "iPhone10,2":
            case "iPhone10,5":
                ret = HardwareVersion.iPhone8Plus;
                break;

            case "iPhone10,3":
            case "iPhone10,6":
                ret = HardwareVersion.iPhoneX;
                break;

            case "iPad1,1":
                ret = HardwareVersion.iPad;
                break;

            case "iPad2,1":
            case "iPad2,2":
            case "iPad2,3":
            case "iPad2,4":
                ret = HardwareVersion.iPad2;
                break;

            case "iPad2,5":
            case "iPad2,6":
            case "iPad2,7":
                ret = HardwareVersion.iPadMini;
                break;

            case "iPad3,1":
            case "iPad3,2":
            case "iPad3,3":
                ret = HardwareVersion.iPad3;
                break;

            case "iPad3,4":
            case "iPad3,5":
            case "iPad3,6":
                ret = HardwareVersion.iPad4;
                break;

            case "iPad4,1":
            case "iPad4,2":
            case "iPad4,3":
                ret = HardwareVersion.iPadAir;
                break;

            case "iPad5,3":
            case "iPad5,4":
                ret = HardwareVersion.iPadAir2;
                break;

            case "iPad6,3":
            case "iPad6,4":
            case "iPad6,7":
            case "iPad6,8":
                ret = HardwareVersion.iPadPro;
                break;

            case "iPad4,4":
            case "iPad4,5":
            case "iPad4,6":
                ret = HardwareVersion.iPadMini2;
                break;

            case "iPad4,7":
            case "iPad4,8":
            case "iPad4,9":
                ret = HardwareVersion.iPadMini3;
                break;

            case "iPad5,1":
            case "iPad5,2":
                ret = HardwareVersion.iPadMini4;
                break;

            case "iPod1,1":
                ret = HardwareVersion.iPod1G;
                break;

            case "iPod2,1":
                ret = HardwareVersion.iPod2G;
                break;

            case "iPod3,1":
                ret = HardwareVersion.iPod3G;
                break;

            case "iPod4,1":
                ret = HardwareVersion.iPod4G;
                break;

            case "iPod5,1":
                ret = HardwareVersion.iPod5G;
                break;

            case "iPod7,1":
                ret = HardwareVersion.iPod6G;
                break;

            case "AppleTV5,3":
                ret = HardwareVersion.AppleTV;
                break;

            case "i386":
            case "x86_64":
                if (UIDevice.CurrentDevice.Model.Contains("iPhone"))
                {
                    ret = HardwareVersion.iPhoneSimulator;
                }
                else
                {
                    ret = HardwareVersion.iPadSimulator;
                }
                break;
            }

            return(ret);
        }
示例#29
0
        public static string GetDisplayVersion(HardwareVersion hVersion, string version)
        {
            switch (hVersion)
            {
            case HardwareVersion.iPhone:
                return("iPhone");

            case HardwareVersion.iPhone3G:
                return("iPhone 3G");

            case HardwareVersion.iPhone3GS:
                return("iPhone 3GS");

            case HardwareVersion.iPhone4:
                return("iPhone 4");

            case HardwareVersion.iPhone4S:
                return("iPhone 4S");

            case HardwareVersion.iPhone5:
                return("iPhone 5");

            case HardwareVersion.iPhone5C:
                return("iPhone 5C");

            case HardwareVersion.iPhone5S:
                return("iPhone 5S");

            case HardwareVersion.iPhone6:
                return("iPhone 6");

            case HardwareVersion.iPhone6Plus:
                return("iPhone 6 Plus");

            case HardwareVersion.iPhone6S:
                return("iPhone 6S");

            case HardwareVersion.iPhone6SPlus:
                return("iPhone 6S Plus");

            case HardwareVersion.iPhoneSE:
                return("iPhone SE");

            case HardwareVersion.iPhone7:
                return("iPhone 7");

            case HardwareVersion.iPhone7Plus:
                return("iPhone 7 Plus");

            case HardwareVersion.iPhone8:
                return("iPhone 8");

            case HardwareVersion.iPhone8Plus:
                return("iPhone 8 Plus");

            case HardwareVersion.iPhoneX:
                return("iPhone X");

            case HardwareVersion.iPad:
                return("iPad");

            case HardwareVersion.iPad2:
                return("iPad 2");

            case HardwareVersion.iPad3:
                return("iPad 3");

            case HardwareVersion.iPad4:
                return("iPad 4");

            case HardwareVersion.iPadAir:
                return("iPad Air");

            case HardwareVersion.iPadAir2:
                return("iPad Air 2");

            case HardwareVersion.iPadPro:
                return("iPad Pro");

            case HardwareVersion.iPadMini:
                return("iPad Mini");

            case HardwareVersion.iPadMini2:
                return("iPad Mini 2");

            case HardwareVersion.iPadMini3:
                return("iPad Mini 3");

            case HardwareVersion.iPadMini4:
                return("iPad Mini 4");

            case HardwareVersion.iPod1G:
                return("iPod Touch");

            case HardwareVersion.iPod2G:
                return("iPod Touch 2G");

            case HardwareVersion.iPod3G:
                return("iPod Touch 3G");

            case HardwareVersion.iPod4G:
                return("iPod Touch 4G");

            case HardwareVersion.iPod5G:
                return("iPod Touch 5G");

            case HardwareVersion.iPod6G:
                return("iPod Touch 6G");

            case HardwareVersion.AppleTV:
                return("Apple TV");

            case HardwareVersion.iPhoneSimulator:
                return("iPhone Simulator");

            case HardwareVersion.iPadSimulator:
                return("iPad Simulator");

            default:
                return(version);
            }
        }
示例#30
0
 internal XBeeSeries1(XBeeController controller,
                      HardwareVersion hardwareVersion = HardwareVersion.XBeeSeries1,
                      NodeAddress address             = null) : base(controller, hardwareVersion, address)
 {
 }
示例#31
0
 /// <summary>
 /// Create a node.
 /// </summary>
 /// <param name="address">The address of the node or null for the controller node.</param>
 /// <param name="version">The hardware version to use for the specified node.</param>
 /// <returns>The specified node.</returns>
 public async Task <XBeeNode> GetNodeAsync(NodeAddress address, HardwareVersion version)
 {
     return(await Task.FromResult(CreateNode(version, address)));
 }