Exemple #1
0
        internal Item(Helper aHelper, Tree aTree, Device aDevice, EventServerUpnp aEventServer, bool aIsProxy)
        {
            iLock        = new object();
            iHelper      = aHelper;
            iTree        = aTree;
            iEventServer = aEventServer;
            iIsProxy     = aIsProxy;
            iBasicSetup  = new BasicSetup(aDevice, aEventServer);
            iPlayback    = new Playback(aHelper, aDevice, aEventServer);

            if (aIsProxy)
            {
                iServiceProxy = new ServiceProxy(aDevice);
            }
            else
            {
                iServiceVolkano = new ServiceVolkano(aDevice);
            }

            if (Box.IsFallBack(aDevice.Udn) && !aIsProxy)
            {
                iBox = iTree.AddFallbackBox(iBasicSetup, aDevice, aEventServer, iProductId, iBoardId.ToArray(), iBoardType.ToArray(), iBoardDescription.ToArray(), iBoardNumber.ToArray(), iSoftwareVersion);
                GetVersionInfo();
            }
            else
            {
                //wait for service product to collect box data before turning on Box
                iServiceProduct = new ServiceProduct(aDevice, iEventServer);
                iServiceProduct.EventInitial += EventHandlerProductInitial;
            }
        }
Exemple #2
0
 public void Reboot()
 {
     if (BasicSetup != null)
     {
         BasicSetup.Reboot();
     }
 }
Exemple #3
0
        private Box AddBox(BasicSetup aBasicSetup, Playback aPlayback, string aModel, string aRoom, string aName, Device aDevice, EventServerUpnp aEventServer, Box.EState aState, string aProductId, string[] aBoardId, string[] aBoardType, string[] aBoardDescription, string[] aBoardNumber, string aImageUri, string aSoftwareVersion, bool aIsProxy)
        {
            Room room;
            Box  box;

            Lock();

            if (iRoomList.TryGetValue(aRoom, out room))
            {
                Unlock();
                box = new Box(iHelper, iUpdateCheck, aBasicSetup, aPlayback, aModel, room, aName, aDevice, aEventServer, aState, aProductId, aBoardId, aBoardType, aBoardDescription, aBoardNumber, aImageUri, aSoftwareVersion, aIsProxy);
            }
            else
            {
                room             = new Room(aRoom);
                iRoomList[aRoom] = room;
                Unlock();

                if (EventRoomAdded != null)
                {
                    EventRoomAdded(this, new EventArgsRoom(room));
                }

                box = new Box(iHelper, iUpdateCheck, aBasicSetup, aPlayback, aModel, room, aName, aDevice, aEventServer, aState, aProductId, aBoardId, aBoardType, aBoardDescription, aBoardNumber, aImageUri, aSoftwareVersion, aIsProxy);
            }

            room.AddBox(box);

            return(box);
        }
Exemple #4
0
        internal void Open(Device aDevice)
        {
            lock (iLock)
            {
                // close previous services cleanly
                if (iIsProxy)
                {
                    iServiceProxy = new ServiceProxy(aDevice);
                }
                else
                {
                    iServiceVolkano = new ServiceVolkano(aDevice);
                }

                iBasicSetup = new BasicSetup(aDevice, iEventServer);
                iPlayback   = new Playback(iHelper, aDevice, iEventServer);

                if (Box.IsFallBack(aDevice.Udn) && !iIsProxy)
                {
                    //if device in fallback state create a box not containing the service product
                    if (iBox != null)
                    {
                        iBox.SetFallback(aDevice);
                    }
                    else
                    {
                        iBox = iTree.AddFallbackBox(iBasicSetup, aDevice, iEventServer, iProductId, iBoardId.ToArray(), iBoardType.ToArray(), iBoardDescription.ToArray(), iBoardNumber.ToArray(), iSoftwareVersion);
                    }
                    GetVersionInfo();
                }
                else
                {
                    if (iServiceProduct != null)
                    {
                        if (!iEventInitialOn)
                        {
                            iServiceProduct.EventInitial -= EventHandlerProductInitial;
                        }
                        else
                        {
                            iServiceProduct.EventInitial -= EventHandlerProductInitialOn;
                        }
                        iServiceProduct.Kill();
                        iServiceProduct = null;
                    }
                    //wait for service product to collect box data before turning on Box
                    iServiceProduct = new ServiceProduct(aDevice, iEventServer);
                    iServiceProduct.EventInitial += EventHandlerProductInitialOn;
                    iEventInitialOn = true;
                }
            }
        }
Exemple #5
0
        //room name is not passed as if the room name had been modified the box would be removed and added to the tree
        internal void SetOn(Device aDevice, string aModel, string aName, BasicSetup aBasicSetup, Playback aPlayback)
        {
            Lock();

            iModel      = aModel;
            iName       = aName;
            iBasicSetup = aBasicSetup;
            iPlayback   = aPlayback;

            Unlock();

            SetState(aDevice, EState.eOn);
        }
Exemple #6
0
        internal Box AddFallbackBox(BasicSetup aBasicSetup, Device aDevice, EventServerUpnp aEventServer, string aProductId, string[] aBoardId, string[] aBoardType, string[] aBoardDescription, string[] aBoardNumber, string aSoftwareVersion)
        {
            string model = aDevice.Model;

            if (model != null && model != "")
            {
                // Originally fallback model was 'Reprogram-Device', pull the device from this
                if (model.Contains("Reprogram-"))
                {
                    string[] list = model.Split('-');
                    if (list.Length > 1)
                    {
                        model = list[1];
                    }
                }
            }
            if (model == null || model == "")
            {
                model = "Unknown";
            }
            return(AddBox(aBasicSetup, model, "Unknown", "Reprogram", aDevice, aEventServer, Box.EState.eFallback, aProductId, aBoardId, aBoardType, aBoardDescription, aBoardNumber, aSoftwareVersion));
        }
Exemple #7
0
 internal Box(Helper aHelper, UpdateCheck aUpdateCheck, BasicSetup aBasicSetup, Playback aPlayback, string aModel, Room aRoom, string aName, Device aDevice, EventServerUpnp aEventServer, EState aState, string aProductId, string[] aBoardId, string[] aBoardType, string[] aBoardDescription, string[] aBoardNumber, string aImageUri, string aSoftwareVersion, bool aIsProxy)
 {
     iHelper          = aHelper;
     iModel           = aModel;
     iRoom            = aRoom;
     iName            = aName;
     iDevice          = aDevice;
     iEventServer     = aEventServer;
     iState           = aState;
     iImageUri        = aImageUri;
     iSoftwareVersion = aSoftwareVersion;
     iUpdateCheck     = aUpdateCheck;
     iBasicSetup      = aBasicSetup;
     iUpdateFirmware  = new UpdateFirmware(aHelper);
     iPlayback        = aPlayback;
     iUpdateCheck.GetInfo(aModel, aIsProxy, aSoftwareVersion, aBoardNumber, out iSoftwareUpdateAvailable, out iSoftwareUpdateVersion, out iSoftwareUpdateUrl, out iSoftwareUpdateVariant, out iReleaseNotesHtml);
     iUpdateCheck.EventUpdateCheckComplete += UpdateCheckComplete;
     iUpdateCheck.EventUpdateCheckError    += UpdateCheckError;
     iSysLogPretty = new SysLogPretty(aHelper.ExePath.FullName);
     iProductId    = aProductId;
     iIsProxy      = aIsProxy;
     if (aBoardId != null)
     {
         iBoardId = aBoardId;
     }
     if (aBoardType != null)
     {
         iBoardType = aBoardType;
     }
     if (aBoardDescription != null)
     {
         iBoardDescription = aBoardDescription;
     }
     if (aBoardNumber != null)
     {
         iBoardNumber = aBoardNumber;
     }
 }
Exemple #8
0
 private Box AddBox(BasicSetup aBasicSetup, string aModel, string aRoom, string aName, Device aDevice, EventServerUpnp aEventServer, Box.EState aState, string aProductId, string[] aBoardId, string[] aBoardType, string[] aBoardDescription, string[] aBoardNumber, string aSoftwareVersion)
 {
     // fallback device
     return(AddBox(aBasicSetup, null, aModel, aRoom, aName, aDevice, aEventServer, aState, aProductId, aBoardId, aBoardType, aBoardDescription, aBoardNumber, null, aSoftwareVersion, false));
 }
Exemple #9
0
 internal Box AddMainBox(BasicSetup aBasicSetup, Playback aPlayback, ServiceProduct aServiceProduct, EventServerUpnp aEventServer, string aProductId, string[] aBoardId, string[] aBoardType, string[] aBoardDescription, string[] aBoardNumber, string aSoftwareVersion)
 {
     return(AddBox(aBasicSetup, aPlayback, aServiceProduct.ModelName, aServiceProduct.ProductRoom, aServiceProduct.ProductName, aServiceProduct.Device, aEventServer, Box.EState.eOn, aProductId, aBoardId, aBoardType, aBoardDescription, aBoardNumber, aServiceProduct.ProductImageUri, aSoftwareVersion, false));
 }