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