Beispiel #1
0
        public void DoTheOtherThing(MDSEvent anEvent, MDSWrapper wrapper)
        {
            System.Diagnostics.Debug.WriteLine("Mooooo ");

            var m = anEvent.BodyDictionary.ValueForKey(new NSString("Method"));

            System.Diagnostics.Debug.WriteLine(m);
            var serial = anEvent.BodyDictionary.ValueForKey(new NSString("Body")).ValueForKey(new NSString("Serial")).ToString();

            //if (!serial.EndsWith("08")) return;

            //var body = new NSDictionary();

            var ledOn = NSDictionary.FromObjectsAndKeys(new object[] {
                true,
                0
            }, new object[] {
                "IsOn",
                "LedColor"
            });

            var body = NSDictionary.FromObjectAndKey(ledOn, new NSString("LedState"));

            //wrapper.DoGet(String.Format("{0}/Component/Leds", serial), new NSDictionary(), (resp) =>
            //{
            //    wrapper.DisconnectPeripheralWithUUID(new Foundation.NSUuid("4CC5B0ED-08A0-C062-B1C2-B4B91D6B254A"));
            //});

            wrapper.DoPut(String.Format("{0}/Component/Leds/0", serial), body, (arg0) =>
            {
                System.Diagnostics.Debug.WriteLine("YOU SHOULD SEE THE LIGHT!!!!");
                wrapper.DisconnectPeripheralWithUUID(new Foundation.NSUuid("4CC5B0ED-08A0-C062-B1C2-B4B91D6B254A"));
            });

            //wrapper.DoGet(String.Format("{0}/Time", serial), new NSDictionary(),
            //(arg0) =>
            //{
            //    System.Diagnostics.Debug.WriteLine("Response" + arg0.BodyDictionary.ValueForKey(new NSString("Content")).ToString());
            //    wrapper.DisconnectPeripheralWithUUID(new Foundation.NSUuid("4CC5B0ED-08A0-C062-B1C2-B4B91D6B254A"));
            //});
        }