]> git.basschouten.com Git - openhab-addons.git/blob
458fbc543a89acc18fb33ed9664fca72e7a43132
[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.mercedesme.internal.config;
14
15 import static org.openhab.binding.mercedesme.internal.Constants.*;
16
17 import org.eclipse.jdt.annotation.NonNullByDefault;
18
19 /**
20  * The {@link AccountConfiguration} class contains fields mapping thing configuration parameters.
21  *
22  * @author Bernd Weymann - Initial contribution
23  */
24 @NonNullByDefault
25 public class AccountConfiguration {
26
27     public String clientId = NOT_SET;
28     public String clientSecret = NOT_SET;
29     public String imageApiKey = NOT_SET;
30
31     // Advanced Parameters
32     public String callbackIP = NOT_SET;
33     public int callbackPort = -1;
34     public boolean odoScope = true;
35     public boolean vehicleScope = true;
36     public boolean lockScope = true;
37     public boolean fuelScope = true;
38     public boolean evScope = true;
39
40     // https://developer.mercedes-benz.com/products/electric_vehicle_status/docs#_required_scopes
41     public String getScope() {
42         StringBuffer sb = new StringBuffer();
43         sb.append(SCOPE_OPENID).append(SPACE).append(SCOPE_OFFLINE);
44         if (odoScope) {
45             sb.append(SPACE).append(SCOPE_ODO);
46         }
47         if (vehicleScope) {
48             sb.append(SPACE).append(SCOPE_STATUS);
49         }
50         if (lockScope) {
51             sb.append(SPACE).append(SCOPE_LOCK);
52         }
53         if (fuelScope) {
54             sb.append(SPACE).append(SCOPE_FUEL);
55         }
56         if (evScope) {
57             sb.append(SPACE).append(SCOPE_EV);
58         }
59         return sb.toString();
60     }
61
62     @Override
63     public String toString() {
64         return "ID " + clientId + ", Secret " + clientSecret + ", IP " + callbackIP + ", Port " + callbackPort
65                 + ", scope " + getScope();
66     }
67 }