public void device_link_service_version_exchange(long major, long minor)
        {
            PListArray  array;
            PListString msg;

            /* receive DLMessageVersionExchange from device */
            array = PropertyListService.Receive(sd) as PListArray;

            msg = array[0] as PListString;

            if (msg.Value != "DLMessageVersionExchange")
            {
                throw new DeviceLinkServiceException("Did not receive DLMessageVersionExchange from device!");
            }

            /* get major and minor version number */
            if (array.Count < 3)
            {
                throw new DeviceLinkServiceException("DLMessageVersionExchange has unexpected format!");
            }

            var value_major = (array[1] as PListInteger).Value;
            var value_minor = (array[2] as PListInteger).Value;

            if (value_major > major)
            {
                throw new DeviceLinkServiceException(
                          String.Format("Version mismatch: device=({0},{1}) > expected=({2},{3})",
                                        value_major, value_minor, major, minor));
            }
            else if (value_major == major && value_minor > minor)
            {
                throw new DeviceLinkServiceException(
                          String.Format("WARNING: Version mismatch: device=(%lld,%lld) > expected=(%lld,%lld)",
                                        value_major, value_minor, major, minor));
            }

            /* version is ok, send reply */
            var relay_array = new PListArray();

            relay_array.Add(new PListString("DLMessageVersionExchange"));
            relay_array.Add(new PListString("DLVersionsOk"));
            relay_array.Add(new PListInteger(minor));

            PropertyListService.Send(sd, relay_array);

            /* receive DeviceReady message */
            var ready_array = PropertyListService.Receive(sd) as PListArray;

            msg = ready_array[0] as PListString;
            if (msg.Value != "DLMessageDeviceReady")
            {
                throw new DeviceLinkServiceException("Did not get DLMessageDeviceReady!");
            }
        }
Beispiel #2
0
        public PListDict GetHomeScreenWallpaperPNGData()
        {
            //throw new NotImplementedException();
            lock (sync)
            {
                PListDict dict = new PListDict();
                dict.Add("command", new PListString("getHomeScreenWallpaperPNGData"));

                PropertyListService.Send(sd, dict);

                var recv = PropertyListService.Receive(sd);

                return(recv as PListDict);
            }
        }
Beispiel #3
0
        public PListDict GetIconPNGData(string bundle_id)
        {
            lock (sync)
            {
                PListDict root = new PListDict();
                root.Add("command", new PListString("getIconPNGData"));
                root.Add("bundleId", new PListString(bundle_id));

                PropertyListService.Send(sd, root);

                var recv = PropertyListService.Receive(sd);

                return(recv as PListDict);
            }
        }
Beispiel #4
0
        public PListDict GetIconState()
        {
            lock (sync)
            {
                PListDict root = new PListDict();
                root.Add("command", new PListString("getIconState"));
                root.Add("formatVersion", new PListString("2"));

                PropertyListService.Send(sd, root);

                var recv_plist = PropertyListService.Receive(sd);

                return(recv_plist as PListDict);
            }
        }
Beispiel #5
0
        public InterfaceOrientation GetInterfaceOrientation()
        {
            lock (sync)
            {
                PListDict dict = new PListDict();
                dict.Add("command", new PListString("getInterfaceOrientation"));

                PropertyListService.Send(sd, dict);

                var recv = PropertyListService.Receive(sd) as PListDict;

                var v = recv["interfaceOrientation"] as PListInteger;

                return((InterfaceOrientation)v.Value);
            }
        }
        public IPListElement device_link_service_receive_process_message()
        {
            var array = PropertyListService.Receive(this.sd) as PListArray;

            if (array.Count != 2)
            {
                throw new DeviceLinkServiceException("Malformed plist received for DLMessageProcessMessage");
            }

            var msg = array[0] as PListString;

            if (msg.Value != "DLMessageProcessMessage")
            {
                throw new DeviceLinkServiceException("Did not receive DLMessageProcessMessage as expected!");
            }

            return(array[1]);
        }
        public PListRoot GetAppList()
        {
            lock (sync)
            {
                var send_plist = CreateBrowsePlist();

                PropertyListService.Send(sd, send_plist);

                PListArray array = new PListArray();

                bool browsing;
                do
                {
                    browsing = false;

                    var dic = PropertyListService.Receive(sd) as PListDict;

                    var status = (dic["Status"] as PListString).Value;

                    if (status == "BrowsingApplications")
                    {
                        browsing = true;

                        var amount       = dic["CurrentAmount"] as PListInteger;
                        var current_list = dic["CurrentList"] as PListArray;

                        array.AddRange(current_list);
                    }
                    else
                    {
                        //status == "Complete"
                        Debug.WriteLine("Browse 完成");
                    }
                } while (browsing);

                return(new PListRoot()
                {
                    Root = array
                });
            }
        }
 public IPListElement device_link_service_receive()
 {
     return(PropertyListService.Receive(this.sd));
 }