-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSkEgn.java
More file actions
131 lines (115 loc) · 4.28 KB
/
SkEgn.java
File metadata and controls
131 lines (115 loc) · 4.28 KB
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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
package com.speechsuper;
public final class SkEgn {
static {
System.loadLibrary("skegn");
}
/**
* Engine callback interface
*/
public interface skegn_callback {
/**
* Abstract function that requires rewriting the function entity when called
* @param id Return ID.
* @param type Return Type.
* @param data Return data.
* @param size Data size.
* @return Return value.
*/
public abstract int run(byte[] id, int type, byte[] data, int size);
}
/** Callback return message type - json */
public static int SKEGN_MESSAGE_TYPE_JSON = 1;
/** Callback return message type - bin */
public static int SKEGN_MESSAGE_TYPE_BIN = 2;
public static int SKEGN_OPT_GET_VERSION = 1;
public static int SKEGN_OPT_GET_MODULES = 2;
public static int SKEGN_OPT_GET_TRAFFIC = 3;
public static int SKEGN_OPT_SET_WIFI_STATUS = 4;
public static int SKEGN_OPT_GET_PROVISION = 5;
public static int SKEGN_OPT_GET_SERIAL_NUMBER = 6;
/**
* Create Engine
* @param cfg configuration information
* @param androidContext Context Object
* @return 0:
* Engine Object Value: Success
*/
public static native long skegn_new(String cfg, Object androidContext);
/**
* Remove Engine
* @param engine Engine Object Value
* @return return value
*/
public static native int skegn_delete(long engine);
/**
* Start engine.
* @param engine Engine Object Value.
* @param param Parameter Configuration String.
* @param id The ID character generated by the storage engine.
* @param callback Skegn_callback object.
* @param androidContext Context Object.
* @return Return value.
*/
public static native int skegn_start(long engine, String param, byte[] id, skegn_callback callback, Object context);
/**
* Fill the engine buffer with voice data.
* @param engine Engine Object Value.
* @param data
* @param size Data size.
* @return Return value.
*/
public static native int skegn_feed(long engine, byte[] data, int size);
/**
* Stop Engine.
* @param engine Engine Object Value.
* @return Return value.
*/
public static native int skegn_stop(long engine);
/**
* Cancel the engine, which is used to allow users to cancel the engine in case of abnormal situations.
* @param engine Engine Object Value.
* @return Return value
*/
public static native int skegn_cancel(long engine);
// public static native int skegn_log(long engine, String log);
public static native int skegn_opt(long engine, int opt, byte[] data, int size);
/**
* Get device ID
* @param device_id Buffer byte [] space for storing IDs.
* @param androidContext Context Object.
* @return Return value.
*/
public static native int skegn_get_device_id(byte[] device_id, Object androidContext);
/**
* Get errno
* @return Return value.
*/
public static native int skegn_get_last_error();
/**
* Update provision
* @param provision_path provision_path Buffer byte space for storing download provision path.
* @param app_key provision_path Buffer byte space of app_key.
* @param secret_key provision_path Buffer byte space of secret_key.
* @param androidContext Context Object.
* @return Return value.
*/
public static native int skegn_update_provision(String provision_path,String app_key,String secret_key);
/**
* Query provision
* @param provision_path Buffer byte [] space for storing provision path.
* @param callback skegn_callback Object.
* @param androidContext Context Object.
* @return Return value.
* callback The third parameter is the return result, format:
*/
public static native int skegn_inquire_provision(String provision_path, skegn_callback callback, Object context);
/**
* Search for OOV word
* @param engine Engine Object Value.
* @param param Parameter Configuration String.
* @return Return value
*/
public static native String skegn_inquire_oov(long engine, String param);
}