summaryrefslogtreecommitdiff
path: root/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/CloudAppProperties.java
blob: 6538496ee7e722070d36db99040aea6a56781581 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
package com.smartdevicelink.proxy.rpc;

import android.support.annotation.NonNull;

import com.smartdevicelink.proxy.RPCStruct;
import com.smartdevicelink.proxy.rpc.enums.HybridAppPreference;

import java.util.Hashtable;

/**
 * Properties that relate to a a cloud app entry.
 */
public class CloudAppProperties extends RPCStruct {
    public static final String KEY_APP_NAME                 = "appName";
    public static final String KEY_APP_ID                   = "appID";
    public static final String KEY_ENABLED                  = "enabled";
    public static final String KEY_AUTH_TOKEN               = "authToken";
    public static final String KEY_CLOUD_TRANSPORT_TYPE     = "cloudTransportType";
    public static final String KEY_HYBRID_APP_PREFERENCE    = "hybridAppPreference";
    public static final String KEY_ENDPOINT                 = "endpoint";


    public CloudAppProperties(){}

    public CloudAppProperties(Hashtable<String, Object> hash) {
        super(hash);
    }

    public CloudAppProperties(@NonNull String appName, @NonNull String appID){
        this();
        setValue(KEY_APP_NAME, appName);
        setValue(KEY_APP_ID, appID);
    }

    public void setAppName(String appName){
        setValue(KEY_APP_NAME, appName);
    }

    public String getAppName(){
        return getString(KEY_APP_NAME);
    }

    public void setAppID(String appID){
        setValue(KEY_APP_ID, appID);
    }

    public String getAppID(){
        return getString(KEY_APP_ID);
    }

    /**
     * If true, this cloud app entry will designate it should appear in the HMI
     * @param enabled if the app should be
     */
    public void setEnabled(boolean enabled){
        setValue(KEY_ENABLED, enabled);
    }

    /**
     * @return if this cloud app entry will designate it should appear in the HMI
     */
    public Boolean isEnabled(){
        return getBoolean(KEY_ENABLED);
    }

    public void setAuthToken(String token){
        setValue(KEY_AUTH_TOKEN, token);
    }

    public String getAuthToken(){
        return getString(KEY_AUTH_TOKEN);
    }

    public void setCloudTransportType(String transportType){
        setValue(KEY_CLOUD_TRANSPORT_TYPE, transportType);
    }

    public String getCloudTransportType(){
        return getString(KEY_CLOUD_TRANSPORT_TYPE);
    }

    public void setHybridAppPreference(HybridAppPreference hybridAppPreference){
        setValue(KEY_HYBRID_APP_PREFERENCE, hybridAppPreference);
    }

    public HybridAppPreference getHybridAppPreference(){
        return (HybridAppPreference)getObject(HybridAppPreference.class, KEY_HYBRID_APP_PREFERENCE);
    }

    /**
     * @param token - max length ="65535"
     */
    public void setEndpoint(String token){
        setValue(KEY_ENDPOINT, token);
    }

    /**
     * @return token - max length ="65535"
     */
    public String getEndpoint(){
        return getString(KEY_ENDPOINT);
    }

}