Exemplo n.º 1
0
        public void InstallApp(string path, int firstFree /*TODO, bool installApp*/)
        {
            PebbleBundle bundle = new PebbleBundle(path);

            if (bundle.BundleType != PebbleBundle.BundleTypes.Application)
            {
                throw new Exception("not an app");
            }
            PutBytesClient c = new PutBytesClient(this, (uint)firstFree, PutBytesType.Binary, bundle.Binary);

            c.init();
            while (!c.IsDone && !c.HasError)
            {
                Thread.Sleep(1000);
            }
            if (c.HasError)
            {
                throw new Exception("couldn't send app");
            }
            if (bundle.HasResources)
            {
                c = new PutBytesClient(this, (uint)firstFree, PutBytesType.Resources, bundle.ResourcesBinary);
                c.init();
                while (!c.IsDone && !c.HasError)
                {
                    Thread.Sleep(1000);
                }
                if (c.HasError)
                {
                    throw new Exception("couldn't send resources");
                }
            }
            var msg = Util.Pack("!bI", 3, firstFree);

            Thread.Sleep(2000);
            sendMessage(Endpoints.APP_MANAGER, msg);
            Thread.Sleep(2000);
        }
Exemplo n.º 2
0
 public void InstallApp(string path, int firstFree/*TODO, bool installApp*/)
 {
     PebbleBundle bundle = new PebbleBundle(path);
     if (bundle.BundleType != PebbleBundle.BundleTypes.Application)
     {
         throw new Exception("not an app");
     }
     PutBytesClient c = new PutBytesClient(this, (uint)firstFree, PutBytesType.Binary, bundle.Binary);
     c.init();
     while (!c.IsDone && !c.HasError)
         Thread.Sleep(1000);
     if (c.HasError)
         throw new Exception("couldn't send app");
     if (bundle.HasResources)
     {
         c = new PutBytesClient(this, (uint)firstFree, PutBytesType.Resources, bundle.ResourcesBinary);
         c.init();
         while (!c.IsDone && !c.HasError)
             Thread.Sleep(1000);
         if (c.HasError)
             throw new Exception("couldn't send resources");
     }
     var msg = Util.Pack("!bI", 3, firstFree);
     Thread.Sleep(2000);
     sendMessage(Endpoints.APP_MANAGER, msg);
     Thread.Sleep(2000);
 }