1 package org.rpi.providers;
2
3 import org.apache.log4j.Logger;
4 import org.openhome.net.device.DvDevice;
5 import org.openhome.net.device.IDvInvocation;
6 import org.openhome.net.device.providers.DvProviderUpnpOrgConnectionManager1;
7 import org.rpi.config.Config;
8 import org.rpi.utils.Utils;
9
10 public class PrvConnectionManager extends DvProviderUpnpOrgConnectionManager1 {
11
12 private Logger log = Logger.getLogger(PrvConnectionManager.class);
13
14 private String currentConnectionIDs = "0";
15
16
17 private String sinkProtocolInfo = Config.getProtocolInfo();
18 private String sourceProtocolInfo = "";
19
20
21 private int iConnectionID = 0;
22
23 private int iAVTransportID = 0;
24
25 private int iRcsID = 0;
26
27 public PrvConnectionManager(DvDevice device) {
28 super(device);
29
30 enablePropertySourceProtocolInfo();
31 setPropertySourceProtocolInfo(sourceProtocolInfo);
32 enablePropertySinkProtocolInfo();
33 setPropertySinkProtocolInfo(sinkProtocolInfo);
34 enablePropertyCurrentConnectionIDs();
35 setPropertyCurrentConnectionIDs(currentConnectionIDs);
36
37
38
39 enableActionGetCurrentConnectionIDs();
40 enableActionGetCurrentConnectionInfo();
41 enableActionGetProtocolInfo();
42 }
43
44 @Override
45 protected PrepareForConnection prepareForConnection(IDvInvocation paramIDvInvocation, String sinkProtocolInfo, String peerConnectionManager, int remoteConnId, String paramString3) {
46
47
48 setPropertySourceProtocolInfo(sinkProtocolInfo);
49
50
51
52
53 log.debug("PrepareForConnection: ProtocolInfo: " + sinkProtocolInfo + " PeerConnectionManager: " + peerConnectionManager + " RemoteConnId: " + remoteConnId + Utils.getLogText(paramIDvInvocation));
54 PrepareForConnection prep = new PrepareForConnection(0, 0, 0);
55 return prep;
56 }
57
58 @Override
59 protected void connectionComplete(IDvInvocation paramIDvInvocation, int paramInt) {
60 log.debug("connectionComplete: " + paramInt + Utils.getLogText(paramIDvInvocation));
61 setPropertyCurrentConnectionIDs("");
62 }
63
64 @Override
65 protected DvProviderUpnpOrgConnectionManager1.GetProtocolInfo getProtocolInfo(IDvInvocation paramIDvInvocation) {
66 log.debug("GetProtocolInfo: " + Utils.getLogText(paramIDvInvocation));
67
68 log.debug("GetProtolInfo Source=" + sourceProtocolInfo + " Sink=" + sinkProtocolInfo);
69 return new DvProviderUpnpOrgConnectionManager1.GetProtocolInfo(getPropertySourceProtocolInfo(), getPropertySinkProtocolInfo());
70 }
71
72 @Override
73 protected String getCurrentConnectionIDs(IDvInvocation paramIDvInvocation) {
74 log.debug("getCurrentConnectionIDs " + Utils.getLogText(paramIDvInvocation));
75 log.debug("ConnectionManager getCurrentConnectionIDs ConnectionIDs=" + getPropertyCurrentConnectionIDs());
76 return getPropertyCurrentConnectionIDs();
77 }
78
79 @Override
80 protected DvProviderUpnpOrgConnectionManager1.GetCurrentConnectionInfo getCurrentConnectionInfo(IDvInvocation paramIDvInvocation, int paramInt) {
81 log.debug("GetCurrentConnectionInfo: " + paramInt + Utils.getLogText(paramIDvInvocation));
82
83
84 setPropertyCurrentConnectionIDs("" + paramInt);
85 String iProtocolInfo = sinkProtocolInfo;
86 String iPeerConnectionManager = "/";
87 int iPeerConnectionID = -1;
88 String iDirection = "Input";
89 String iStatus = "Unknown";
90
91 log.debug("ConnectionManager response: GetCurrentConnectionInfo: RcsID=" + iRcsID + " AVTransportID=" + iAVTransportID + " ProtocolInfo=" + iProtocolInfo + " PeerConnectionManager=" + iPeerConnectionManager + " PeerConnectionID=" + iPeerConnectionID + " Direction=" + iDirection + " Status=" + iStatus);
92 return new DvProviderUpnpOrgConnectionManager1.GetCurrentConnectionInfo(iRcsID, iAVTransportID, iProtocolInfo, iPeerConnectionManager, iPeerConnectionID, iDirection, iStatus);
93 }
94
95
96
97
98
99
100
101
102 }