]> git.basschouten.com Git - openhab-addons.git/blob
597bdfa76408103f29965e5220a80bf07c679506
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2021 Contributors to the openHAB project
3  *
4  * See the NOTICE file(s) distributed with this work for additional
5  * information.
6  *
7  * This program and the accompanying materials are made available under the
8  * terms of the Eclipse Public License 2.0 which is available at
9  * http://www.eclipse.org/legal/epl-2.0
10  *
11  * SPDX-License-Identifier: EPL-2.0
12  */
13 package org.openhab.binding.magentatv.internal;
14
15 import java.nio.charset.StandardCharsets;
16 import java.util.Collections;
17 import java.util.Set;
18
19 import org.eclipse.jdt.annotation.NonNullByDefault;
20 import org.openhab.core.thing.ThingTypeUID;
21
22 /**
23  * The {@link MagentaTVBindingConstants} class defines common constants, which are
24  * used across the whole binding.
25  *
26  * @author Markus Michels - Initial contribution
27  */
28 @NonNullByDefault
29 public class MagentaTVBindingConstants {
30
31     public static final String BINDING_ID = "magentatv";
32     public static final String VENDOR = "Deutsche Telekom";
33     public static final String OEM_VENDOR = "HUAWEI";
34
35     // List of all Thing Type UIDs
36     public static final ThingTypeUID THING_TYPE_RECEIVER = new ThingTypeUID(BINDING_ID, "receiver");
37     public static final Set<ThingTypeUID> SUPPORTED_THING_TYPES = Collections.singleton(THING_TYPE_RECEIVER);
38
39     /**
40      * Property names for config/status properties
41      */
42     public static final String PROPERTY_UDN = "udn";
43     public static final String PROPERTY_FRIENDLYNAME = "friendlyName";
44     public static final String PROPERTY_MODEL_NUMBER = "modelRev";
45     public static final String PROPERTY_HOST = "host";
46     public static final String PROPERTY_IP = "ipAddress";
47     public static final String PROPERTY_PORT = "port";
48     public static final String PROPERTY_DESC_URL = "descriptionUrl";
49     public static final String PROPERTY_PAIRINGCODE = "pairingCode";
50     public static final String PROPERTY_VERIFICATIONCODE = "verificationCode";
51     public static final String PROPERTY_ACCT_NAME = "accountName";
52     public static final String PROPERTY_ACCT_PWD = "accountPassword";
53     public static final String PROPERTY_USERID = "userId";
54     public static final String PROPERTY_LOCAL_IP = "localIP";
55     public static final String PROPERTY_LOCAL_MAC = "localMAC";
56     public static final String PROPERTY_TERMINALID = "terminalID";
57     public static final String PROPERTY_WAKEONLAN = "wakeOnLAN";
58
59     /**
60      * Channel names
61      */
62     public static final String CHGROUP_CONTROL = "control";
63     public static final String CHANNEL_POWER = CHGROUP_CONTROL + "#" + "power";
64     public static final String CHANNEL_PLAYER = CHGROUP_CONTROL + "#" + "player";
65     public static final String CHANNEL_MUTE = CHGROUP_CONTROL + "#" + "mute";
66     public static final String CHANNEL_CHANNEL = CHGROUP_CONTROL + "#" + "channel";
67     public static final String CHANNEL_KEY = CHGROUP_CONTROL + "#" + "key";
68
69     public static final String CHGROUP_PROGRAM = "program";
70     public static final String CHANNEL_PROG_TITLE = CHGROUP_PROGRAM + "#" + "title";
71     public static final String CHANNEL_PROG_TEXT = CHGROUP_PROGRAM + "#" + "text";
72     public static final String CHANNEL_PROG_START = CHGROUP_PROGRAM + "#" + "start";
73     public static final String CHANNEL_PROG_DURATION = CHGROUP_PROGRAM + "#" + "duration";
74     public static final String CHANNEL_PROG_POS = CHGROUP_PROGRAM + "#" + "position";
75
76     public static final String CHGROUP_STATUS = "status";
77     public static final String CHANNEL_CHANNEL_CODE = CHGROUP_STATUS + "#" + "channelCode";
78     public static final String CHANNEL_RUN_STATUS = CHGROUP_STATUS + "#" + "runStatus";
79     public static final String CHANNEL_PLAY_MODE = CHGROUP_STATUS + "#" + "playMode";
80
81     /**
82      * Definitions for the control interface
83      */
84     public static final String CONTENT_TYPE_XML = "text/xml; charset=UTF-8";
85
86     public static final String PAIRING_NOTIFY_URI = "/magentatv/notify";
87     public static final String NOTIFY_PAIRING_CODE = "X-pairingCheck:";
88
89     public static final String MODEL_MR400 = "DMS_TPB"; // Old DSL receiver
90     public static final String MODEL_MR401B = "MR401B"; // New DSL receiver
91     public static final String MODEL_MR601 = "MR601"; // SAT receiver
92     public static final String MODEL_MR201 = "MR201"; // sub receiver
93
94     public static final String MR400_DEF_REMOTE_PORT = "49152";
95     public static final String MR400_DEF_DESCRIPTION_URL = "/description.xml";
96     public static final String MR401B_DEF_REMOTE_PORT = "8081";
97     public static final String MR401B_DEF_DESCRIPTION_URL = "/xml/dial.xml";
98     public static final String DEF_FRIENDLY_NAME = "PAD:openHAB";
99
100     public static final int DEF_REFRESH_INTERVAL_SEC = 60;
101     public static final int NETWORK_TIMEOUT_MS = 3000;
102
103     public static final String UTF_8 = StandardCharsets.UTF_8.name();
104
105     public static final String HEADER_CONTENT_TYPE = "Content-Type";
106     public static final String HEADER_HOST = "HOST";
107     public static final String HEADER_ACCEPT = "Accept";
108     public static final String HEADER_CACHE_CONTROL = "Cache-Control";
109     public static final String HEADER_LANGUAGE = "Accept-Language";
110     public static final String HEADER_SOAPACTION = "SOAPACTION";
111     public static final String HEADER_CONNECTION = "CONNECTION";
112     public static final String HEADER_USER_AGENT = "USER_AGENT";
113     public static final String USER_AGENT = "Darwin/16.5.0 UPnP/1.0 HUAWEI_iCOS/iCOS V1R1C00 DLNADOC/1.50";
114     public static final String ACCEPT_TYPE = "*/*";
115
116     /**
117      * OAuth authentication for Deutsche Telekom MatengaTV portal
118      */
119     public static final String OAUTH_GET_CRED_URL = "https://slbedmfk11100.prod.sngtv.t-online.de";
120     public static final String OAUTH_GET_CRED_PORT = "33428";
121     public static final String OAUTH_GET_CRED_URI = "/EDS/JSON/Login?UserID=Guest";
122     public static final String OAUTH_USER_AGENT = "Mozilla/5.0 (iPhone; CPU iPhone OS 10_3_3 like Mac OS X) AppleWebKit/603.3.8 (KHTML, like Gecko) Mobile/14G60 (400962928)";
123
124     //
125     // MR events
126     //
127     public static final String MR_EVENT_EIT_CHANGE = "EVENT_EIT_CHANGE";
128
129     public static final String MR_EVENT_CHAN_TAG = "\"channel_num\":";
130
131     /**
132      * program Info event data
133      * EVENT_EIT_CHANGE: for a complete list see
134      * http://support.huawei.com/hedex/pages/DOC1100366313CEH0713H/01/DOC1100366313CEH0713H/01/resources/dsv_hdx_idp/DSV/en/en-us_topic_0094619523.html
135      */
136     public static final int EV_EITCHG_RUNNING_NONE = 0;
137     public static final int EV_EITCHG_RUNNING_NOT_RUNNING = 1;
138     public static final int EV_EITCHG_RUNNING_STARTING = 2;
139     public static final int EV_EITCHG_RUNNING_PAUSING = 3;
140     public static final int EV_EITCHG_RUNNING_RUNNING = 4;
141
142     /**
143      * playStatus event data
144      * EVENT_PLAYMODE_CHANGE: for a complete list see
145      * http://support.huawei.com/hedex/pages/DOC1100366313CEH0713H/01/DOC1100366313CEH0713H/01/resources/dsv_hdx_idp/DSV/en/en-us_topic_0094619231.html
146      */
147     public static final int EV_PLAYCHG_STOP = 0; // STOP: stop status.
148     public static final int EV_PLAYCHG_PAUSE = 1; // PAUSE: pause status.
149     public static final int EV_PLAYCHG_PLAY = 2; // NORMAL_PLAY: normal playback status for non-live content
150                                                  // (including TSTV).
151     public static final int EV_PLAYCHG_TRICK = 3; // TRICK_MODE: trick play mode, such as fast-forward, rewind,
152                                                   // slow-forward, and slow-rewind.
153     public static final int EV_PLAYCHG_MC_PLAY = 4; // MULTICAST_CHANNEL_PLAY: live broadcast status of IPTV
154                                                     // multicast channels and DVB channels.
155     public static final int EV_PLAYCHG_UC_PLAY = 5; // UNICAST_CHANNEL_PLAY: live broadcast status of IPTV unicast
156                                                     // channels and OTT channels. //
157     public static final int EV_PLAYCHG_BUFFERING = 20; // BUFFERING: playback buffering status, including playing
158                                                        // cPVR content during the recording, playing content
159                                                        // during the download, playing the OTT content, and no
160                                                        // data in the buffer area.
161
162     //
163     // MagentaTVControl SOAP requests
164     //
165     public static final String CHECKDEV_URI = "http://{0}:{1}{2}";
166
167     public static final int PAIRING_TIMEOUT_SEC = 300;
168     public static final String PAIRING_CONTROL_URI = "/upnp/service/X-CTC_RemotePairing/Control";
169     public static final String PAIRING_SUBSCRIBE = "SUBSCRIBE /upnp/service/X-CTC_RemotePairing/Event HTTP/1.1\r\nHOST: {0}:{1}\r\nCALLBACK: <http://{2}:{3}{4}>\r\nNT: upnp:event\r\nTIMEOUT: Second-{5}\r\nCONNECTION: close\r\n\r\n";
170     public static final String CONNECTION_CLOSE = "close";
171
172     public static final String SOAP_ENVELOPE = "<s:Envelope xmlns:s=\"http://schemas.xmlsoap.org/soap/envelope/\" s:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\"><s:Body>{0}</s:Body></s:Envelope>";
173     public static final String PAIRING_SOAP_ACTION = "\"urn:schemas-upnp-org:service:X-CTC_RemotePairing:1#X-pairingRequest\"";
174     public static final String PAIRING_SOAP_BODY = "<u:X-pairingRequest xmlns:u=\"urn:schemas-upnp-org:service:X-CTC_RemotePairing:1\"><pairingDeviceID>{0}</pairingDeviceID><friendlyName>{1}</friendlyName><userID>{2}</userID></u:X-pairingRequest>";
175
176     public static final String PAIRCHECK_URI = "/upnp/service/X-CTC_RemotePairing/Control";
177     public static final String PAIRCHECK_SOAP_ACTION = "\"urn:schemas-upnp-org:service:X-CTC_RemotePairing:1#X-pairingCheck\"";
178     public static final String PAIRCHECK_SOAP_BODY = "<u:X-pairingCheck xmlns:u=\"urn:schemas-upnp-org:service:X-CTC_RemotePairing:1\"><pairingDeviceID>{0}</pairingDeviceID><verificationCode>{1}</verificationCode></u:X-pairingCheck>";
179
180     public static final String SENDKEY_URI = "/upnp/service/X-CTC_RemoteControl/Control";
181     public static final String SENDKEY_SOAP_ACTION = "\"urn:schemas-upnp-org:service:X-CTC_RemoteControl:1#X_CTC_RemoteKey\"";
182     public static final String SENDKEY_SOAP_BODY = "<u:X_CTC_RemoteKey xmlns:u=\"urn:schemas-upnp-org:service:X-CTC_RemoteControl:1\"><InstanceID>0</InstanceID><KeyCode>keyCode={0}^{1}:{2}^userID:{3}</KeyCode></u:X_CTC_RemoteKey>";
183
184     public static final String HTTP_NOTIFY = "NOTIFY";
185     public static final String NOTIFY_SID = "SID: ";
186
187     public static final String HASH_ALGORITHM_MD5 = "MD5";
188     public static final String HASH_ALGORITHM_SHA256 = "SHA-256";
189 }