summaryrefslogtreecommitdiff
path: root/SDL_Android/LivioSdlUtilities/src/com/livio/sdl/enums/SdlSpeechCapability.java
blob: f99379b3ee62da33877d464b23f948030b7ced1a (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
package com.livio.sdl.enums;

import com.smartdevicelink.proxy.rpc.enums.SpeechCapabilities;


/**
 * Specifies different types of text-to-speech capabilities available through SmartDeviceLink.  When
 * an application wants the vehicle to speak something to the user, the application can deliver
 * any of the input strings formatted according to the options in this enumerated class.
 * 
 * @see SpeechCapabilities
 * 
 * @author Mike Burke
 */
public enum SdlSpeechCapability {
	/**
	 * Represents a standard text-to-speech translation.
	 */
	TEXT("Text"),
	/**
	 * Represents a SAPI phoneme text string.
	 */
	SAPI_PHONEMES("SAPI Phonemes"),
	/**
	 * Represents a LHPLUS phoneme text string.
	 */
	LHPLUS_PHONEMES("LHPLUS Phonemes"),
	/**
	 * Represents a pre-recorded text entry stored exclusively on the head-unit.
	 */
	PRE_RECORDED("Pre-recorded"),
	/**
	 * Represents a period of silence, for example, a pause between sentences.
	 */
	SILENCE("Silence"),
    
    // future languages go here
    
    ;

    private final String READABLE_NAME;
    
    private SdlSpeechCapability(String readableName) {
        this.READABLE_NAME = readableName;
    }
    
    /**
     * Translates the input SpeechCapabilities object into an SdlSpeechCapability object.
     * 
     * @param input The SpeechCapabilities object to translate
     * @return The translated SdlSpeechCapability object
     */
    public static SdlSpeechCapability translateFromLegacy(SpeechCapabilities input){
    	switch(input){
    	case TEXT:
    		return TEXT;
    	case LHPLUS_PHONEMES:
    		return LHPLUS_PHONEMES;
    	case SAPI_PHONEMES:
    		return SAPI_PHONEMES;
    	case SILENCE:
    		return SILENCE;
    	case PRE_RECORDED:
    		return PRE_RECORDED;
    	default:
    		return null;
    	}
    }
    
    /**
     * Translates the input SdlSpeechCapabilities object into a SpeechCapability object.
     * 
     * @param input The SdlSpeechCapabilities object to translate
     * @return The translated SpeechCapability object
     */
    public static SpeechCapabilities translateToLegacy(SdlSpeechCapability input){
    	switch(input){
    	case TEXT:
    		return SpeechCapabilities.TEXT;
    	case LHPLUS_PHONEMES:
    		return SpeechCapabilities.LHPLUS_PHONEMES;
    	case SAPI_PHONEMES:
    		return SpeechCapabilities.SAPI_PHONEMES;
    	case SILENCE:
    		return SpeechCapabilities.SILENCE;
    	case PRE_RECORDED:
    		return SpeechCapabilities.PRE_RECORDED;
    	default:
    		return null;
    	}
    }
	
	@Override
	public String toString(){
		return this.READABLE_NAME;
	}
}