Example #1
0
        public MSEDevice(IntermediateDevice intermediateDevice)
        {
            this.Identifier = intermediateDevice.identifier;
            this.Orientation = intermediateDevice.orientation;
            this.Location = intermediateDevice.location;

            intersectionPoint = new Dictionary<string, double>();
            intersectionPoint.Add("x", 0);
            intersectionPoint.Add("y", 0);

            threadLock = new object();
        }
Example #2
0
        public static IntermediateDevice GetCompleteIntermediateDevice(Device device)
        {
            if (device == null)
            {
                return null;
            }
            IntermediateDevice intermediateDevice = new IntermediateDevice();

            intermediateDevice.identifier = device.Identifier;
            intermediateDevice.orientation = device.Orientation;
            intermediateDevice.location = device.Location;

            // We only want to return devices for which all of the properties are known
            if (intermediateDevice.isComplete)
                return intermediateDevice;
            else
                return null;
        }
Example #3
0
        // For transmission, we create objects with an anonymous type where the instance variable names precisely match the ones on iOS.
        // ie, identifier instead of Identifier
        // This makes deserialization on the client easier.
        public static List<IntermediateDevice> GetCompleteIntermediateDevicesList(List<Device> devices)
        {
            List<IntermediateDevice> intermediateDevices = new List<IntermediateDevice>();
            foreach (Device device in devices)
            {
                IntermediateDevice intermediateDevice = new IntermediateDevice
                {
                    orientation = device.Orientation,
                    identifier = device.Identifier,
                    location = device.Location,
                    intersectionPoint = new Point(device.intersectionPoint["x"], device.intersectionPoint["y"])
                };

                if (intermediateDevice.isComplete)
                {
                    intermediateDevices.Add(intermediateDevice);
                }

            }

            return intermediateDevices;
        }