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; } }
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(); } }
private void DeviceAdded(CpDeviceList aList, CpDevice aDevice) { lock (this) { PrintDeviceInfo("Added", aDevice); aDevice.AddRef(); iDeviceList.Add(aDevice); } }
private void DeviceAdded(CpDeviceList aList, CpDevice aDevice) { lock (this) { if (aDevice.Udn() == DeviceBasic.gDeviceName) { aDevice.AddRef(); iDeviceList.Add(aDevice); } } }
protected static void Removed(IntPtr aPtr, uint aHandle) { CpDevice device = new CpDevice(aHandle); GCHandle gch = GCHandle.FromIntPtr(aPtr); CpDeviceList list = (CpDeviceList)gch.Target; if (list.iRemoved != null) { list.iRemoved(list, device); } }
private void PrintDeviceInfo(string aPrologue, CpDevice aDevice) { string location; aDevice.GetAttribute("Upnp.Location", out location); string friendlyName; aDevice.GetAttribute("Upnp.FriendlyName", out friendlyName); Console.Write(aPrologue + "\n udn = " + aDevice.Udn() + "\n location = " + location + "\n name = " + friendlyName + "\n"); }
private void DeviceRemoved(CpDeviceList aList, CpDevice aDevice) { lock (this) { string udn = aDevice.Udn(); int count = iDeviceList.Count; for (int i = 0; i < count; i++) { if (iDeviceList[i].Udn() == udn) { iDeviceList.RemoveAt(i); iDeviceList[i].RemoveRef(); } } } }
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(); }
public CpProxyLinnCoUkDebug2(CpDevice aDevice) { iHandle = CpProxyLinnCoUkDebug2Create(aDevice.Handle()); iGch = GCHandle.Alloc(this); }
public CpProxyLinnCoUkConfiguration1(CpDevice aDevice) { iHandle = CpProxyLinnCoUkConfiguration1Create(aDevice.Handle()); iGch = GCHandle.Alloc(this); }
public CpProxyLinnCoUkVolkano1(CpDevice aDevice) { iHandle = CpProxyLinnCoUkVolkano1Create(aDevice.Handle()); iGch = GCHandle.Alloc(this); }
public CpProxyLinnCoUkComponent1(CpDevice aDevice) { iHandle = CpProxyLinnCoUkComponent1Create(aDevice.Handle()); iGch = GCHandle.Alloc(this); }
public CpProxyUpnpOrgDimming1(CpDevice aDevice) { iHandle = CpProxyUpnpOrgDimming1Create(aDevice.Handle()); iGch = GCHandle.Alloc(this); }
public CpProxyLinnCoUkDiagnostics1(CpDevice aDevice) { iHandle = CpProxyLinnCoUkDiagnostics1Create(aDevice.Handle()); iGch = GCHandle.Alloc(this); }
public CpProxyUpnpOrgContentDirectory2(CpDevice aDevice) { iHandle = CpProxyUpnpOrgContentDirectory2Create(aDevice.Handle()); iGch = GCHandle.Alloc(this); }
public CpProxyUpnpOrgConnectionManager1(CpDevice aDevice) { iHandle = CpProxyUpnpOrgConnectionManager1Create(aDevice.Handle()); iGch = GCHandle.Alloc(this); }
public CpProxyZappOrgTestDimmableLight1(CpDevice aDevice) { iHandle = CpProxyZappOrgTestDimmableLight1Create(aDevice.Handle()); iGch = GCHandle.Alloc(this); }
public CpProxyUpnpOrgScheduledRecording1(CpDevice aDevice) { iHandle = CpProxyUpnpOrgScheduledRecording1Create(aDevice.Handle()); iGch = GCHandle.Alloc(this); }
public CpProxyLinnCoUkMediaTime1(CpDevice aDevice) { iHandle = CpProxyLinnCoUkMediaTime1Create(aDevice.Handle()); iGch = GCHandle.Alloc(this); }
public CpProxyUpnpOrgSwitchPower1(CpDevice aDevice) { iHandle = CpProxyUpnpOrgSwitchPower1Create(aDevice.Handle()); iGch = GCHandle.Alloc(this); }
public CpProxyZappOrgTestBasic1(CpDevice aDevice) { iHandle = CpProxyZappOrgTestBasic1Create(aDevice.Handle()); iGch = GCHandle.Alloc(this); }
public CpProxyLinnCoUkPreamp4(CpDevice aDevice) { iHandle = CpProxyLinnCoUkPreamp4Create(aDevice.Handle()); iGch = GCHandle.Alloc(this); }
public CpProxyUpnpOrgAVTransport1(CpDevice aDevice) { iHandle = CpProxyUpnpOrgAVTransport1Create(aDevice.Handle()); iGch = GCHandle.Alloc(this); }