private void PropertyCurrentConnectionIDsChanged(IntPtr aPtr)
        {
            GCHandle gch = GCHandle.FromIntPtr(aPtr);
            CpProxyUpnpOrgConnectionManager1 self = (CpProxyUpnpOrgConnectionManager1)gch.Target;

            self.iCurrentConnectionIDsChanged();
        }
        private void PropertySinkProtocolInfoChanged(IntPtr aPtr)
        {
            GCHandle gch = GCHandle.FromIntPtr(aPtr);
            CpProxyUpnpOrgConnectionManager1 self = (CpProxyUpnpOrgConnectionManager1)gch.Target;

            self.iSinkProtocolInfoChanged();
        }
Exemplo n.º 3
0
 private void PollSubscribe()
 {
     iSubscriptionSem = new Semaphore(0, 1);
     for (int i = 0; i < iDeviceList.Count; i++)
     {
         CpDevice device = iDeviceList[i];
         string   udn    = device.Udn();
         if (udn == "896659847466-a4badbeaacbc-737837" ||
             udn == "541d0cb5-3b34-4264-8ff0-d8653acf6425")
         {
             continue;
         }
         uint countBefore = iSubscriptionCount;
         Console.Write("Device " + device.Udn());
         CpProxyUpnpOrgConnectionManager1 connMgr = new CpProxyUpnpOrgConnectionManager1(device);
         connMgr.SetPropertyChanged(PropertyChanged);
         DateTime startTime = DateTime.Now;
         while (true)
         {
             connMgr.Subscribe();
             iSubscriptionSem.WaitOne((int)(2 * kDevicePollMs));
             connMgr.Unsubscribe();
             DateTime now = DateTime.Now;
             if (now.Subtract(startTime).TotalSeconds > kDevicePollSecs)
             {
                 break;
             }
             iSubscriptionCount++;
         }
         Console.Write("    " + (iSubscriptionCount - countBefore) + "\n");
         connMgr.Dispose();
     }
 }
Exemplo n.º 4
0
 private void PollInvoke()
 {
     iActionPollStop = new Semaphore(0, 1);
     System.Timers.Timer timer = new System.Timers.Timer();
     timer.Elapsed  += TimerElapsed;
     timer.AutoReset = false;
     for (int i = 0; i < iDeviceList.Count; i++)
     {
         CpDevice device      = iDeviceList[i];
         uint     countBefore = iActionCount;
         Console.Write("Device " + device.Udn());
         iConnMgr            = new CpProxyUpnpOrgConnectionManager1(device);
         iActionPollStopTime = DateTime.Now.AddMilliseconds(kDevicePollMs);
         timer.Interval      = kDevicePollMs;
         timer.Enabled       = false;
         timer.Enabled       = true;
         for (int j = 0; j < 4; j++)
         {
             iConnMgr.BeginGetProtocolInfo(GetProtocolInfoComplete);
         }
         iActionPollStop.WaitOne();
         Console.Write("    " + (iActionCount - countBefore) + "\n");
         iConnMgr.Dispose();
         iExpectedSink = null;
     }
 }
Exemplo n.º 5
0
        private void InvokeSync()
        {
            // trivial validation of the sync wrappers to all APIs
            // single sync call to whichever device happens to be first in our list
            if (iDeviceList.Count == 0)
            {
                Console.Write("No devices found, so nothing to test\n");
                return;
            }
            CpDevice device = iDeviceList[0];

            Console.Write("\n\nSync call to device " + device.Udn() + "\n");
            CpProxyUpnpOrgConnectionManager1 connMgr = new CpProxyUpnpOrgConnectionManager1(device);
            string source;
            string sink;

            connMgr.SyncGetProtocolInfo(out source, out sink);
            Console.Write("source is " + source + "\nsink is " + sink + "\n");
            connMgr.Dispose();
        }