Example #1
0
 internal void InvokeEventSubscriptionFailed(UPnPError error)
 {
     try
     {
         if (_eventSubscriptionFailed != null)
         {
             _eventSubscriptionFailed(this, error);
         }
     }
     catch (Exception e)
     {
         UPnPConfiguration.LOGGER.Warn("CpService: Error invoking EventSubscriptionFailed delegate", e);
     }
 }
Example #2
0
        public void TestSearch()
        {
            UPnPContentDirectoryServiceImpl service = new UPnPContentDirectoryServiceImpl();

            DvAction browse = service.Actions["Search"];

            IList <object> input = new object[] { "0", "upnp:class derivedfrom \"object.container.playlistContainer\" and @refID exists false", "dc:title,microsoft:folderPath", (uint)0, (uint)200, "+dc:title" };
            IList <object> output;
            UPnPError      error = browse.InvokeAction(input, out output, false, CreateContext());

            Console.WriteLine("Error: {0}", error);
            Console.WriteLine("Output: {0}", output);
            Console.WriteLine("Output list: [{0}]", string.Join(",", output));
        }
Example #3
0
        public void TestBrowse()
        {
            UPnPContentDirectoryServiceImpl service = new UPnPContentDirectoryServiceImpl();

            DvAction browse = service.Actions["Browse"];

            IList <object> input = new object[] { "0", "BrowseDirectChildren", "*", (uint)0, (uint)200, "" };
            IList <object> output;
            UPnPError      error = browse.InvokeAction(input, out output, false, CreateContext());

            Console.WriteLine("Error: {0}", error);
            Console.WriteLine("Output: {0}", output);
            Console.WriteLine("Output list: [{0}]", string.Join(",", output));
        }
Example #4
0
 internal void ActionErrorResultPresent(UPnPError error)
 {
     lock (_syncObj)
         _error = error;
     ActionFinished();
 }
Example #5
0
        internal void ActionErrorResultPresent(UPnPError error, object handle)
        {
            AsyncActionCallResult asyncResult = (AsyncActionCallResult)handle;

            asyncResult.ActionErrorResultPresent(error);
        }
 private void SubscribeFailed(CpService service, UPnPError error)
 {
     Log.Log.Error("DRI: failed to subscribe to state variable events for service {0}, code = {1}, description = {2}", _unqualifiedServiceName, error.ErrorCode, error.ErrorDescription);
 }
        static UPnPError OnScheduleImports(DvAction action, IList <object> inParams, out IList <object> outParams,
                                           CallContext context)
        {
            outParams = null;
            ICollection <Guid> shareIds         = MarshallingHelper.ParseCsvGuidCollection((string)inParams[0]);
            string             importJobTypeStr = (string)inParams[1];
            ImportJobType      importJobType;
            UPnPError          error = ParseImportJobType("ImportJobType", importJobTypeStr, out importJobType);

            if (error != null)
            {
                return(error);
            }

            IMediaLibrary             mediaLibrary = ServiceRegistration.Get <IMediaLibrary>();
            IDictionary <Guid, Share> allShares    = mediaLibrary.GetShares(null);
            IDictionary <string, ICollection <Share> > importRequests = new Dictionary <string, ICollection <Share> >();

            foreach (Guid shareId in shareIds)
            {
                Share importShare;
                if (!allShares.TryGetValue(shareId, out importShare))
                {
                    // Share not found
                    continue;
                }
                ICollection <Share> systemShares;
                if (!importRequests.TryGetValue(importShare.SystemId, out systemShares))
                {
                    importRequests[importShare.SystemId] = new List <Share> {
                        importShare
                    }
                }
                ;
                else
                {
                    systemShares.Add(importShare);
                }
            }
            // Local imports at the server
            ISystemResolver     systemResolver = ServiceRegistration.Get <ISystemResolver>();
            ICollection <Share> shares;

            if (importRequests.TryGetValue(systemResolver.LocalSystemId, out shares))
            {
                IImporterWorker importerWorker = ServiceRegistration.Get <IImporterWorker>();
                foreach (Share share in shares)
                {
                    if (importJobType == ImportJobType.Import)
                    {
                        importerWorker.ScheduleImport(share.BaseResourcePath, share.MediaCategories, true);
                    }
                    else
                    {
                        importerWorker.ScheduleRefresh(share.BaseResourcePath, share.MediaCategories, true);
                    }
                }
            }
            ServiceRegistration.Get <IThreadPool>().Add(() => ScheduleClientImports(importRequests, importJobType));
            return(null);
        }
Example #8
0
 public UPnPRemoteException(UPnPError error) :
     base(error.ErrorDescription)
 {
     _error = error;
 }