]> git.basschouten.com Git - openhab-addons.git/blob
f43a751ef5f0dd40b688a00d40e6cad5d87a5b40
[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.mybmw.internal.utils;
14
15 import java.util.List;
16 import java.util.Map;
17
18 import org.eclipse.jdt.annotation.NonNullByDefault;
19
20 /**
21  * The {@link BimmerConstants} This class holds the important constants for the BMW Connected Drive Authorization. They
22  * are taken from the Bimmercode from github <a href="https://github.com/bimmerconnected/bimmer_connected">
23  * https://github.com/bimmerconnected/bimmer_connected</a>.
24  * File defining these constants
25  * <a href="https://github.com/bimmerconnected/bimmer_connected/blob/master/bimmer_connected/account.py">
26  * https://github.com/bimmerconnected/bimmer_connected/blob/master/bimmer_connected/account.py</a>
27  * <a href="https://customer.bmwgroup.com/one/app/oauth.js">https://customer.bmwgroup.com/one/app/oauth.js</a>
28  *
29  * @author Bernd Weymann - Initial contribution
30  * @author Martin Grassl - update to v2 API
31  */
32 @NonNullByDefault
33 public interface BimmerConstants {
34
35     static final String REGION_NORTH_AMERICA = "NORTH_AMERICA";
36     static final String REGION_CHINA = "CHINA";
37     static final String REGION_ROW = "ROW";
38
39     static final String BRAND_BMW = "bmw";
40     static final String BRAND_BMWI = "bmw_i";
41     static final String BRAND_MINI = "mini";
42     static final List<String> REQUESTED_BRANDS = List.of(BRAND_BMW, BRAND_MINI);
43
44     static final String OAUTH_ENDPOINT = "/gcdm/oauth/authenticate";
45     static final String AUTH_PROVIDER = "gcdm";
46
47     static final String EADRAX_SERVER_NORTH_AMERICA = "cocoapi.bmwgroup.us";
48     static final String EADRAX_SERVER_ROW = "cocoapi.bmwgroup.com";
49     static final String EADRAX_SERVER_CHINA = "myprofile.bmw.com.cn";
50     static final Map<String, String> EADRAX_SERVER_MAP = Map.of(REGION_NORTH_AMERICA, EADRAX_SERVER_NORTH_AMERICA,
51             REGION_CHINA, EADRAX_SERVER_CHINA, REGION_ROW, EADRAX_SERVER_ROW);
52
53     static final String OCP_APIM_KEY_NORTH_AMERICA = "31e102f5-6f7e-7ef3-9044-ddce63891362";
54     static final String OCP_APIM_KEY_ROW = "4f1c85a3-758f-a37d-bbb6-f8704494acfa";
55     static final Map<String, String> OCP_APIM_KEYS = Map.of(REGION_NORTH_AMERICA, OCP_APIM_KEY_NORTH_AMERICA,
56             REGION_ROW, OCP_APIM_KEY_ROW);
57
58     static final String CHINA_PUBLIC_KEY = "/eadrax-coas/v1/cop/publickey";
59     static final String CHINA_LOGIN = "/eadrax-coas/v2/login/pwd";
60
61     // Http variables
62     static final String APP_VERSION_NORTH_AMERICA = "2.12.0(19883)";
63     static final String APP_VERSION_ROW = "2.12.0(19883)";
64     static final String APP_VERSION_CHINA = "2.3.0(13603)";
65     static final Map<String, String> APP_VERSIONS = Map.of(REGION_NORTH_AMERICA, APP_VERSION_NORTH_AMERICA, REGION_ROW,
66             APP_VERSION_ROW, REGION_CHINA, APP_VERSION_CHINA);
67     static final String USER_AGENT = "Dart/2.16 (dart:io)";
68     // see const.py of bimmer_constants: user-agent; brand; app_version; region
69     static final String X_USER_AGENT = "android(SP1A.210812.016.C1);%s;%s;%s";
70
71     static final String LOGIN_NONCE = "login_nonce";
72     static final String AUTHORIZATION_CODE = "authorization_code";
73
74     // Parameters for API Requests
75     static final String TIRE_GUARD_MODE = "tireGuardMode";
76     static final String APP_DATE_TIME = "appDateTime";
77     static final String APP_TIMEZONE = "apptimezone";
78
79     // API endpoints
80     static final String API_OAUTH_CONFIG = "/eadrax-ucs/v1/presentation/oauth/config";
81     static final String API_VEHICLES = "/eadrax-vcs/v4/vehicles";
82     static final String API_REMOTE_SERVICE_BASE_URL = "/eadrax-vrccs/v3/presentation/remote-commands/"; // '/{vin}/{service_type}'
83     static final String API_POI = "/eadrax-dcs/v1/send-to-car/send-to-car";
84 }