Skip to content

Commit c175fe1

Browse files
authored
Merge pull request #13 from SEPIA-Framework/dev
v2.2.1 b1
2 parents b771883 + 0514c41 commit c175fe1

File tree

9 files changed

+575
-24
lines changed

9 files changed

+575
-24
lines changed

pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
<groupId>net.b07z.sepia.server.core</groupId>
66
<artifactId>sepia-core-tools</artifactId>
7-
<version>2.2.0</version>
7+
<version>2.2.1</version>
88
<name>SEPIA Core-Tools</name>
99
<description>The Core-Tools repository contains classes and methods that are shared by all SEPIA servers and other tools like the SDK.</description>
1010
<url>https://github.com/SEPIA-Framework/sepia-core-tools-java</url>
@@ -105,7 +105,7 @@
105105
<dependency>
106106
<groupId>com.fasterxml.jackson.core</groupId>
107107
<artifactId>jackson-databind</artifactId>
108-
<version>2.9.8</version>
108+
<version>2.9.9</version>
109109
</dependency>
110110
<dependency>
111111
<groupId>commons-lang</groupId>

src/main/java/net/b07z/sepia/server/core/assistant/CLIENTS.java

Lines changed: 43 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,17 @@
88
*/
99
public class CLIENTS {
1010

11+
public enum Platform {
12+
android,
13+
ios,
14+
browser,
15+
windows,
16+
java,
17+
python,
18+
nodejs,
19+
unknown
20+
}
21+
1122
//this is somewhat identical with ENVIRONMENTS but we keep it anyway ^^
1223
final public static String WEB_APP = "web_app"; //e.g. HTML Browser
1324
final public static String BROWSER = "browser"; //e.g. HTML Browser (alternative to web app)
@@ -17,20 +28,50 @@ public class CLIENTS {
1728
final public static String IOS_BROWSER = "ios_browser"; //e.g. iPhone, iPad safari
1829
final public static String WIN_APP = "windows_app"; //e.g. windows app store app for mobile or desktop
1930
final public static String JAVA_APP = "java_app"; //e.g. VW TTS Client
31+
final public static String PYTHON_APP = "python_app";
32+
final public static String NODEJS_APP = "nodejs_app";
2033
final public static String CHROME_BROWSER = "chrome_browser";
2134
final public static String CHROME_APP = "chrome_app";
2235
final public static String SAFARI_BROWSER = "safari_browser";
2336
final public static String SAFARI_APP = "safari_app";
2437
final public static String WAKEWORD_TOOL = "wakeword_tool";
2538

2639
/**
27-
* Return basic for of the client, e.g. convert "web_app_v1.0.1" to "web_app".
40+
* Try to identify the platform by using the client info. NOTE: since a developer can in theory define any client info
41+
* this might not be 100% reliable.
42+
* @param clientInfo - info given by any client
43+
* @return
44+
*/
45+
public static Platform getPlatform(String clientInfo){
46+
clientInfo = clientInfo.toLowerCase();
47+
if (clientInfo.matches(".*(^|_)(browser|web|html|chrome|safari|firefox|edge|ie)($|_).*")){
48+
return Platform.browser;
49+
}else if (clientInfo.matches(".*(^|_)(android)($|_).*")){
50+
return Platform.android;
51+
}else if (clientInfo.matches(".*(^|_)(ios)($|_).*")){
52+
return Platform.ios;
53+
}else if (clientInfo.matches(".*(^|_)(windows|win)($|_).*")){
54+
return Platform.windows;
55+
}else if (clientInfo.matches(".*(^|_)(java)($|_).*")){
56+
return Platform.java;
57+
}else if (clientInfo.matches(".*(^|_)(python)($|_).*")){
58+
return Platform.python;
59+
}else if (clientInfo.matches(".*(^|_)(node|nodejs)($|_).*")){
60+
return Platform.nodejs;
61+
}else{
62+
return Platform.unknown;
63+
}
64+
}
65+
66+
/**
67+
* Return basic for of the client, e.g. convert "web_app_v1.0.1" to "web_app".<br>
68+
* NOTE: This will INCLUDE the device ID given by the user (if any) at the start. If you are using this in a service you can compare it to input.deviceId.
2869
* @param clientInfo - info given by any client
2970
*/
3071
public static String getBaseClient(String clientInfo){
3172
return clientInfo.replaceFirst("_v\\d.*?(_|$)", "_").trim().replaceFirst("_$", "").replaceAll("[\\W]", "").trim();
3273
}
33-
74+
3475
//TODO: I think we need to update/simplify this ... and we should write some tests as well! ;-)
3576

3677
/**

src/main/java/net/b07z/sepia/server/core/assistant/CMD.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ public class CMD {
1414
final public static String BANKING = "banking"; //parameters: action (<pay>, <show>, <send>), receiver, number, currency
1515
final public static String CAR_WELCOME_UPDATE = "car_welcome_up"; //parameters: -
1616
final public static String CHAT = "chat"; //parameters: apology, complain, compliment, question, ...
17-
final public static String CLIENT_CONTROLS = "client_controls"; //parameters: client_fun
17+
final public static String CLIENT_CONTROLS = "client_controls"; //parameters: client_fun
18+
final public static String PLATFORM_CONTROLS = "platform_controls"; //parameters: android_fun, ios_fun, browser_fun, device_fun
1819
final public static String CONTEXT = "context"; //parameters: - all of the previous command ... -
1920
final public static String CONTROL = "control"; //parameters: type (lights, heater, ...), action (on, off, set, inc. ... complex?), info (room etc.), number (for temp. etc.)
2021
final public static String COUNT = "count"; //parameters: number, memory (saves numbers said)

src/main/java/net/b07z/sepia/server/core/assistant/PARAMETERS.java

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -84,10 +84,14 @@ public class PARAMETERS {
8484
final public static String FOOD_CLASS = "food_class"; //italienisch, vegetarisch, vegan
8585

8686
//RADIO - MUSIC
87-
final public static String RADIO_STATION = "radio_station"; //name of a radio station
87+
final public static String RADIO_STATION = "radio_station"; //name of a radio station
8888
final public static String SONG = "song"; //a song
89-
final public static String MUSIC_ARTIST = "artist"; //an artist (music or something else)
90-
final public static String MUSIC_GENRE = "genre"; //music genre (other genres too?)
89+
final public static String MUSIC_ARTIST = "artist"; //an music artist - TODO: Note that ARTIST and GENRE don't use the music_ suffix here!
90+
final public static String MUSIC_ALBUM = "music_album"; //an album
91+
final public static String MUSIC_GENRE = "genre"; //music genre
92+
final public static String MUSIC_SERVICE = "music_service"; //service like Spotify or Apple Music
93+
final public static String PLAYLIST_NAME = "playlist_name"; //name of a playlist
94+
final public static String MEDIA_CONTROLS = "media_controls"; //controls for media players like: next, back, louder, stop, play (might partially overlap with ACTION)
9195

9296
//SMART DEVICES
9397
final public static String SMART_DEVICE = "smart_device"; //any smart device
@@ -109,8 +113,13 @@ public class PARAMETERS {
109113
final public static String MESH_NODE_PLUGIN_NAME = "node_plugin_name"; //name of mesh node plugin
110114
final public static String MESH_NODE_PLUGIN_DATA = "node_plugin_data"; //data (e.g. as JSON string) for node plugin
111115

112-
//CLIENT CONTROLS
116+
//CLIENT and (CLIENT-)PLATFORM CONTROLS
113117
final public static String CLIENT_FUN = "client_fun"; //a function to be executed in client
118+
final public static String ANDROID_FUN = "android_fun"; // " "
119+
final public static String IOS_FUN = "ios_fun"; // " "
120+
final public static String BROWSER_FUN = "browser_fun"; // " "
121+
final public static String WINDOWS_FUN = "windows_fun"; // " "
122+
final public static String DEVICE_FUN = "device_fun"; // " "
114123

115124
//------------ control parameters -------------
116125

@@ -125,11 +134,11 @@ public class PARAMETERS {
125134
final public static String CS_COMMAND = "cs_cmd"; //custom service command, so the target server can map it
126135

127136
//CONTROL PARAMETERS
128-
final public static String SELECTION = "selection"; //control parameter: when a command requires the user to choose one of the results ...(use numbers, maybe names too)
129137
final public static String ANSWER_STAGE = "ans_stage"; //control parameter: ...if you want to keep track of dialog_stage in command or want to have the option to skip stages
130138
final public static String MEMORY = "memory"; //control parameter: ...if you want to keep track of things that have been said already like a command history
131139
final public static String FINAL = "final"; //control parameter: collect parameter names here that are checked, validated and final. Use a list like "[location_start,location_end,time]"
132140
final public static String CONFIRMATION = "confirmation"; //control parameter: when a critical command requires a confirmation ...(use: ok, cancel)
141+
final public static String SELECTION = "selection"; //control parameter: when a command requires the user to choose one of the results ...(use numbers, maybe names too)
133142
final public static String DYNAMIC = "dynamic"; //control parameter: collect parameter names here that are dynamically set during service module to include them in interview build scripts. Use a list like in FINAL
134143

135144
//Exotic or unique stuff

0 commit comments

Comments
 (0)