lignite 0.3.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.rubocop.yml +28 -0
- data/NEWS.md +6 -0
- data/Rakefile +22 -1
- data/VERSION +1 -1
- data/bin/ev3tool +2 -149
- data/examples/bobbee.rb +95 -73
- data/lib/lignite.rb +2 -0
- data/lib/lignite/assembler.rb +1 -1
- data/lib/lignite/bytes.rb +10 -2
- data/lib/lignite/connection.rb +13 -5
- data/lib/lignite/connection/bluetooth.rb +1 -0
- data/lib/lignite/connection/replay.rb +8 -10
- data/lib/lignite/connection/tap.rb +2 -8
- data/lib/lignite/connection/usb.rb +2 -0
- data/lib/lignite/defines.rb +244 -0
- data/lib/lignite/defines.rb.erb +14 -0
- data/lib/lignite/direct_commands.rb +1 -0
- data/lib/lignite/enums.rb +659 -0
- data/lib/lignite/enums.rb.erb +21 -0
- data/lib/lignite/ev3_ops.rb +9401 -0
- data/lib/lignite/ev3_tool.rb +175 -0
- data/lib/lignite/logger.rb +1 -0
- data/lib/lignite/message.rb +2 -0
- data/lib/lignite/motors.rb +1 -1
- data/lib/lignite/op_compiler.rb +14 -126
- data/lib/lignite/system_commands.rb +25 -26
- data/lignite.gemspec +17 -2
- data/spec/assembler_spec.rb +0 -2
- data/spec/data/ev3tool_download.yml +3 -0
- data/spec/data/ev3tool_list_files.yml +3 -0
- data/spec/data/ev3tool_start.yml +4 -0
- data/spec/data/ev3tool_stop.yml +2 -0
- data/spec/data/ev3tool_upload.yml +5 -0
- data/spec/data/everstorm.rbf +0 -0
- data/spec/direct_commands_spec.rb +1 -0
- data/spec/ev3_tool_spec.rb +71 -0
- data/spec/spec_helper.rb +6 -1
- data/tools/ops_from_yml +176 -0
- metadata +44 -16
data/lib/lignite.rb
CHANGED
@@ -15,6 +15,7 @@ require "lignite/op_compiler"
|
|
15
15
|
require "lignite/rbf_object"
|
16
16
|
require "lignite/system_commands"
|
17
17
|
require "lignite/variables"
|
18
|
+
require "lignite/version"
|
18
19
|
|
19
20
|
module Lignite
|
20
21
|
PORT_A = 1
|
@@ -35,6 +36,7 @@ module Lignite
|
|
35
36
|
# empty class, just for documentation purposes
|
36
37
|
end
|
37
38
|
|
39
|
+
# Represents an error returned by the robot
|
38
40
|
class VMError < RuntimeError
|
39
41
|
end
|
40
42
|
end
|
data/lib/lignite/assembler.rb
CHANGED
@@ -61,7 +61,7 @@ module Lignite
|
|
61
61
|
# FIXME: id is not written?!
|
62
62
|
logger.debug "VMTHREAD #{id}"
|
63
63
|
logger.debug " size #{bodyc.bytes.bytesize}"
|
64
|
-
logger.debug " " +
|
64
|
+
logger.debug " " + bin_to_hex(bodyc.bytes)
|
65
65
|
@objects << RbfObject.vmthread(body: bodyc.bytes, local_bytes: @locals.bytesize)
|
66
66
|
end
|
67
67
|
end
|
data/lib/lignite/bytes.rb
CHANGED
@@ -33,8 +33,16 @@ module Lignite
|
|
33
33
|
s.unpack("e").first
|
34
34
|
end
|
35
35
|
|
36
|
-
|
37
|
-
|
36
|
+
# @param hex [String] "413432"
|
37
|
+
# @return [ByteString] "A42"
|
38
|
+
def hex_to_bin(hex)
|
39
|
+
[hex].pack("H*")
|
40
|
+
end
|
41
|
+
|
42
|
+
# @param bin [ByteString] "A42"
|
43
|
+
# @return [String] "413432"
|
44
|
+
def bin_to_hex(bin)
|
45
|
+
bin.unpack("H*").first
|
38
46
|
end
|
39
47
|
end
|
40
48
|
end
|
data/lib/lignite/connection.rb
CHANGED
@@ -1,4 +1,7 @@
|
|
1
1
|
module Lignite
|
2
|
+
# The communication channel to the robot.
|
3
|
+
# The callers use {#send} and {#receive}.
|
4
|
+
# Subclasses implement {#read}, {#write} and {#close}.
|
2
5
|
class Connection
|
3
6
|
include Bytes
|
4
7
|
include Logger
|
@@ -25,6 +28,16 @@ module Lignite
|
|
25
28
|
@buf = ""
|
26
29
|
end
|
27
30
|
|
31
|
+
# @!group Subclasses must implement
|
32
|
+
|
33
|
+
# @!method read(maxlen)
|
34
|
+
# @param maxlen [Integer]
|
35
|
+
|
36
|
+
# @!method write(data)
|
37
|
+
# @param data [ByteString]
|
38
|
+
|
39
|
+
# @!endgroup
|
40
|
+
|
28
41
|
def close
|
29
42
|
Connection.reset
|
30
43
|
end
|
@@ -52,11 +65,6 @@ module Lignite
|
|
52
65
|
res
|
53
66
|
end
|
54
67
|
|
55
|
-
# @!group Subclasses must implement
|
56
|
-
# @!method read(maxlen)
|
57
|
-
# @!method write(data)
|
58
|
-
# @!method close
|
59
|
-
|
60
68
|
private
|
61
69
|
|
62
70
|
# read must not be called with a too low value :-/
|
@@ -2,12 +2,15 @@ require "yaml"
|
|
2
2
|
|
3
3
|
module Lignite
|
4
4
|
class Connection
|
5
|
+
# Errors that may happen when using a {Replay} connection.
|
5
6
|
class ReplayError < RuntimeError
|
6
7
|
end
|
7
8
|
|
8
9
|
# Replays a recorded communication.
|
9
10
|
# It checks that #send matches the stored sends, replays the #receive.
|
10
11
|
class Replay < Connection
|
12
|
+
include Bytes
|
13
|
+
|
11
14
|
def initialize(filename)
|
12
15
|
@filename = filename
|
13
16
|
|
@@ -24,11 +27,14 @@ module Lignite
|
|
24
27
|
# @param payload [ByteString]
|
25
28
|
def send(payload)
|
26
29
|
recorded = @stream.shift
|
27
|
-
raise ReplayError, "Nothing left in the recording" if recorded.nil?
|
30
|
+
raise ReplayError, "Nothing left in the recording (#{@filename})" if recorded.nil?
|
28
31
|
hex = recorded["SEND"]
|
29
32
|
raise ReplayError, "Called SEND but the recording says RECV" if hex.nil?
|
30
33
|
data = hex_to_bin(hex)
|
31
|
-
|
34
|
+
return if data == payload
|
35
|
+
|
36
|
+
details = "actual: #{bin_to_hex(payload)}, recorded: #{hex}"
|
37
|
+
raise ReplayError, "Called SEND but the recorded data does not match: #{details}"
|
32
38
|
end
|
33
39
|
|
34
40
|
# @return [ByteString] a complete message
|
@@ -44,14 +50,6 @@ module Lignite
|
|
44
50
|
super
|
45
51
|
raise ReplayError, "Called close but the recording has leftover data" unless @stream.empty?
|
46
52
|
end
|
47
|
-
|
48
|
-
private
|
49
|
-
|
50
|
-
# @param hex [String] "413432"
|
51
|
-
# @return [ByteString] "A42"
|
52
|
-
def hex_to_bin(hex)
|
53
|
-
[hex].pack("H*")
|
54
|
-
end
|
55
53
|
end
|
56
54
|
end
|
57
55
|
end
|
@@ -5,6 +5,8 @@ module Lignite
|
|
5
5
|
# An adapter that delegates to another connection
|
6
6
|
# and records the communication
|
7
7
|
class Tap < Connection
|
8
|
+
include Bytes
|
9
|
+
|
8
10
|
def initialize(conn, filename)
|
9
11
|
raise "File #{filename} exists, will not overwrite" if File.exist?(filename)
|
10
12
|
@conn = conn
|
@@ -32,14 +34,6 @@ module Lignite
|
|
32
34
|
super
|
33
35
|
@conn.close
|
34
36
|
end
|
35
|
-
|
36
|
-
private
|
37
|
-
|
38
|
-
# @param bin [ByteString] "A42"
|
39
|
-
# @return [String] "413432"
|
40
|
-
def bin_to_hex(bin)
|
41
|
-
bin.unpack("H*").first
|
42
|
-
end
|
43
37
|
end
|
44
38
|
end
|
45
39
|
end
|
@@ -0,0 +1,244 @@
|
|
1
|
+
# This file is generated from its .erb template. DO NOT EDIT.
|
2
|
+
|
3
|
+
module Lignite
|
4
|
+
# Number of output ports in the system
|
5
|
+
OUTPUTS = 4
|
6
|
+
|
7
|
+
# Number of input ports in the system
|
8
|
+
INPUTS = 4
|
9
|
+
|
10
|
+
# Number of buttons in the system
|
11
|
+
BUTTONS = 6
|
12
|
+
|
13
|
+
# Number of LEDs in the system
|
14
|
+
LEDS = 4
|
15
|
+
|
16
|
+
# LCD horizontal pixels
|
17
|
+
LCD_WIDTH = 178
|
18
|
+
|
19
|
+
# LCD vertical pixels
|
20
|
+
LCD_HEIGHT = 128
|
21
|
+
|
22
|
+
# Top line vertical pixels
|
23
|
+
TOPLINE_HEIGHT = 10
|
24
|
+
|
25
|
+
# Store levels
|
26
|
+
LCD_STORE_LEVELS = 3
|
27
|
+
|
28
|
+
DEFAULT_VOLUME = 100
|
29
|
+
|
30
|
+
DEFAULT_SLEEPMINUTES = 30
|
31
|
+
|
32
|
+
# Forground color
|
33
|
+
FG_COLOR = 1
|
34
|
+
|
35
|
+
# Background color
|
36
|
+
BG_COLOR = 0
|
37
|
+
|
38
|
+
# Number of bricks in the USB daisy chain (master + slaves)
|
39
|
+
CHAIN_DEPT = 4
|
40
|
+
|
41
|
+
# Max path size excluding trailing forward slash including zero termination
|
42
|
+
PATHSIZE = 84
|
43
|
+
|
44
|
+
# Max name size including zero termination (must be divideable by 4)
|
45
|
+
NAMESIZE = 32
|
46
|
+
|
47
|
+
# Max extension size including dot and zero termination
|
48
|
+
EXTSIZE = 5
|
49
|
+
|
50
|
+
# Max filename size including path, name, extension and termination (must be divideable by 4)
|
51
|
+
FILENAMESIZE = 120
|
52
|
+
|
53
|
+
# Max WIFI MAC size including zero termination
|
54
|
+
MACSIZE = 18
|
55
|
+
|
56
|
+
# Max WIFI IP size including zero termination
|
57
|
+
IPSIZE = 16
|
58
|
+
|
59
|
+
# Max bluetooth address size including zero termination
|
60
|
+
BTADRSIZE = 13
|
61
|
+
|
62
|
+
# Inclusive zero termination
|
63
|
+
ERR_STRING_SIZE = 32
|
64
|
+
|
65
|
+
EVENT_NONE = 0
|
66
|
+
|
67
|
+
EVENT_BT_PIN = 1
|
68
|
+
|
69
|
+
EVENT_BT_REQ_CONF = 2
|
70
|
+
|
71
|
+
# Highest valid device type
|
72
|
+
MAX_VALID_TYPE = 101
|
73
|
+
|
74
|
+
# Folder for non volatile user programs/data
|
75
|
+
MEMORY_FOLDER = "/mnt/ramdisk".freeze
|
76
|
+
|
77
|
+
# Folder for On Brick Programming programs
|
78
|
+
PROGRAM_FOLDER = "../prjs/BrkProg_SAVE".freeze
|
79
|
+
|
80
|
+
# Folder for On Brick Data log files
|
81
|
+
DATALOG_FOLDER = "../prjs/BrkDL_SAVE".freeze
|
82
|
+
|
83
|
+
# Folder for SD card mount
|
84
|
+
SDCARD_FOLDER = "../prjs/SD_Card".freeze
|
85
|
+
|
86
|
+
# Folder for USB stick mount
|
87
|
+
USBSTICK_FOLDER = "../prjs/USB_Stick".freeze
|
88
|
+
|
89
|
+
# Project folder
|
90
|
+
PRJS_DIR = "../prjs".freeze
|
91
|
+
|
92
|
+
# Apps folder
|
93
|
+
APPS_DIR = "../apps".freeze
|
94
|
+
|
95
|
+
# Tools folder
|
96
|
+
TOOLS_DIR = "../tools".freeze
|
97
|
+
|
98
|
+
# Temporary folder
|
99
|
+
TMP_DIR = "../tmp".freeze
|
100
|
+
|
101
|
+
# Folder for non volatile settings
|
102
|
+
SETTINGS_DIR = "../sys/settings".freeze
|
103
|
+
|
104
|
+
# Max directory items allocated including "." and ".."
|
105
|
+
DIR_DEEPT = 127
|
106
|
+
|
107
|
+
# Last run filename
|
108
|
+
LASTRUN_FILE_NAME = "lastrun".freeze
|
109
|
+
|
110
|
+
# Calibration data filename
|
111
|
+
CALDATA_FILE_NAME = "caldata".freeze
|
112
|
+
|
113
|
+
# File used in "Sleep" app to save status
|
114
|
+
SLEEP_FILE_NAME = "Sleep".freeze
|
115
|
+
|
116
|
+
# File used in "Volume" app to save status
|
117
|
+
VOLUME_FILE_NAME = "Volume".freeze
|
118
|
+
|
119
|
+
# File used in "WiFi" app to save status
|
120
|
+
WIFI_FILE_NAME = "WiFi".freeze
|
121
|
+
|
122
|
+
# File used in "Bluetooth" app to save status
|
123
|
+
BLUETOOTH_FILE_NAME = "Bluetooth".freeze
|
124
|
+
|
125
|
+
# Robot Sound File
|
126
|
+
EXT_SOUND = ".rsf".freeze
|
127
|
+
|
128
|
+
# Robot Graphics File
|
129
|
+
EXT_GRAPHICS = ".rgf".freeze
|
130
|
+
|
131
|
+
# Robot Byte code File
|
132
|
+
EXT_BYTECODE = ".rbf".freeze
|
133
|
+
|
134
|
+
# Robot Text File
|
135
|
+
EXT_TEXT = ".rtf".freeze
|
136
|
+
|
137
|
+
# Robot Datalog File
|
138
|
+
EXT_DATALOG = ".rdf".freeze
|
139
|
+
|
140
|
+
# Robot Program File
|
141
|
+
EXT_PROGRAM = ".rpf".freeze
|
142
|
+
|
143
|
+
# Robot Configuration File
|
144
|
+
EXT_CONFIG = ".rcf".freeze
|
145
|
+
|
146
|
+
# Robot Archive File
|
147
|
+
EXT_ARCHIVE = ".raf".freeze
|
148
|
+
|
149
|
+
# Brick name maximal size (including zero termination)
|
150
|
+
BRICKNAMESIZE = 120
|
151
|
+
|
152
|
+
# Bluetooth pass key size (including zero termination)
|
153
|
+
BTPASSKEYSIZE = 7
|
154
|
+
|
155
|
+
# WiFi pass key size (including zero termination)
|
156
|
+
WIFIPASSKEYSIZE = 33
|
157
|
+
|
158
|
+
# Character set allowed in brick name and raw filenames
|
159
|
+
CHARSET_NAME = 1
|
160
|
+
|
161
|
+
# Character set allowed in file names
|
162
|
+
CHARSET_FILENAME = 2
|
163
|
+
|
164
|
+
# Character set allowed in bluetooth pass key
|
165
|
+
CHARSET_BTPASSKEY = 4
|
166
|
+
|
167
|
+
# Character set allowed in WiFi pass key
|
168
|
+
CHARSET_WIFIPASSKEY = 8
|
169
|
+
|
170
|
+
# Character set allowed in WiFi ssid
|
171
|
+
CHARSET_WIFISSID = 16
|
172
|
+
|
173
|
+
# DATA8 negative limit
|
174
|
+
DATA8_MIN = -127
|
175
|
+
|
176
|
+
# DATA8 positive limit
|
177
|
+
DATA8_MAX = 127
|
178
|
+
|
179
|
+
# DATA16 negative limit
|
180
|
+
DATA16_MIN = -32767
|
181
|
+
|
182
|
+
# DATA16 positive limit
|
183
|
+
DATA16_MAX = 32767
|
184
|
+
|
185
|
+
# DATA32 negative limit
|
186
|
+
DATA32_MIN = -2147483647
|
187
|
+
|
188
|
+
# DATA32 positive limit
|
189
|
+
DATA32_MAX = 2147483647
|
190
|
+
|
191
|
+
# DATAF negative limit
|
192
|
+
DATAF_MIN = -2147483647
|
193
|
+
|
194
|
+
# DATAF positive limit
|
195
|
+
DATAF_MAX = 2147483647
|
196
|
+
|
197
|
+
DATA8_NAN = 128
|
198
|
+
|
199
|
+
DATA16_NAN = 32768
|
200
|
+
|
201
|
+
DATA32_NAN = 2147483648
|
202
|
+
|
203
|
+
DATAF_NAN = 2143289344
|
204
|
+
|
205
|
+
PULSE_GUI_BACKGROUND = 1
|
206
|
+
|
207
|
+
PULSE_BROWSER = 2
|
208
|
+
|
209
|
+
PULSE_KEY = 4
|
210
|
+
|
211
|
+
POP3_ABS_X = 16
|
212
|
+
|
213
|
+
POP3_ABS_Y = 50
|
214
|
+
|
215
|
+
POP3_ABS_WARN_ICON_X = 64
|
216
|
+
|
217
|
+
POP3_ABS_WARN_ICON_X1 = 40
|
218
|
+
|
219
|
+
POP3_ABS_WARN_ICON_X2 = 72
|
220
|
+
|
221
|
+
POP3_ABS_WARN_ICON_X3 = 104
|
222
|
+
|
223
|
+
POP3_ABS_WARN_ICON_Y = 60
|
224
|
+
|
225
|
+
POP3_ABS_WARN_SPEC_ICON_X = 88
|
226
|
+
|
227
|
+
POP3_ABS_WARN_SPEC_ICON_Y = 60
|
228
|
+
|
229
|
+
POP3_ABS_WARN_TEXT_X = 80
|
230
|
+
|
231
|
+
POP3_ABS_WARN_TEXT_Y = 68
|
232
|
+
|
233
|
+
POP3_ABS_WARN_YES_X = 72
|
234
|
+
|
235
|
+
POP3_ABS_WARN_YES_Y = 90
|
236
|
+
|
237
|
+
POP3_ABS_WARN_LINE_X = 21
|
238
|
+
|
239
|
+
POP3_ABS_WARN_LINE_Y = 89
|
240
|
+
|
241
|
+
POP3_ABS_WARN_LINE_ENDX = 155
|
242
|
+
|
243
|
+
# .
|
244
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<%# This ERB template uses Ruby to generate Ruby. -%>
|
2
|
+
module Lignite
|
3
|
+
<% yml["defines"].each do |dname, ddata| -%>
|
4
|
+
<% desc = ddata["desc"] -%>
|
5
|
+
<% if desc -%>
|
6
|
+
# <%= desc %>
|
7
|
+
<% end -%>
|
8
|
+
<% dvalue = ddata["value"].inspect -%>
|
9
|
+
<% dvalue += ".freeze" if dvalue[0] == '"' -%>
|
10
|
+
<%= dname %> = <%= dvalue %>
|
11
|
+
|
12
|
+
<% end -%>
|
13
|
+
# .
|
14
|
+
end
|
@@ -0,0 +1,659 @@
|
|
1
|
+
# This file is generated from its .erb template. DO NOT EDIT.
|
2
|
+
|
3
|
+
module Lignite
|
4
|
+
# enum: TYPE
|
5
|
+
# Type values for byte codes
|
6
|
+
|
7
|
+
# Mode value that won't change mode in byte codes (convenient place to define)
|
8
|
+
MODE_KEEP = -1
|
9
|
+
|
10
|
+
# Type value that won't change type in byte codes
|
11
|
+
TYPE_KEEP = 0
|
12
|
+
|
13
|
+
# Device is NXT touch sensor
|
14
|
+
TYPE_NXT_TOUCH = 1
|
15
|
+
|
16
|
+
# Device is NXT light sensor
|
17
|
+
TYPE_NXT_LIGHT = 2
|
18
|
+
|
19
|
+
# Device is NXT sound sensor
|
20
|
+
TYPE_NXT_SOUND = 3
|
21
|
+
|
22
|
+
# Device is NXT color sensor
|
23
|
+
TYPE_NXT_COLOR = 4
|
24
|
+
|
25
|
+
# Device is NXT ultra sonic sensor
|
26
|
+
TYPE_NXT_ULTRASONIC = 5
|
27
|
+
|
28
|
+
# Device is NXT temperature sensor
|
29
|
+
TYPE_NXT_TEMPERATURE = 6
|
30
|
+
|
31
|
+
# Device is EV3/NXT tacho motor
|
32
|
+
TYPE_TACHO = 7
|
33
|
+
|
34
|
+
# Device is EV3 mini tacho motor
|
35
|
+
TYPE_MINITACHO = 8
|
36
|
+
|
37
|
+
# Device is EV3 new tacho motor
|
38
|
+
TYPE_NEWTACHO = 9
|
39
|
+
|
40
|
+
# Device is EV3 touch sensor
|
41
|
+
TYPE_TOUCH = 16
|
42
|
+
|
43
|
+
# Device is EV3 color sensor
|
44
|
+
TYPE_COLOR = 29
|
45
|
+
|
46
|
+
# Device is EV3 ultra sonic sensor
|
47
|
+
TYPE_ULTRASONIC = 30
|
48
|
+
|
49
|
+
# Device is EV3 gyro sensor
|
50
|
+
TYPE_GYRO = 32
|
51
|
+
|
52
|
+
# Device is EV3 IR sensor
|
53
|
+
TYPE_IR = 33
|
54
|
+
|
55
|
+
TYPE_THIRD_PARTY_START = 50
|
56
|
+
|
57
|
+
TYPE_THIRD_PARTY_END = 98
|
58
|
+
|
59
|
+
# Device is energy meter
|
60
|
+
TYPE_ENERGYMETER = 99
|
61
|
+
|
62
|
+
# Device type is not known yet
|
63
|
+
TYPE_IIC_UNKNOWN = 100
|
64
|
+
|
65
|
+
# Device is a NXT ADC test sensor
|
66
|
+
TYPE_NXT_TEST = 101
|
67
|
+
|
68
|
+
# Device is NXT IIC sensor
|
69
|
+
TYPE_NXT_IIC = 123
|
70
|
+
|
71
|
+
# Port is connected to a terminal
|
72
|
+
TYPE_TERMINAL = 124
|
73
|
+
|
74
|
+
# Port not empty but type has not been determined
|
75
|
+
TYPE_UNKNOWN = 125
|
76
|
+
|
77
|
+
# Port empty or not available
|
78
|
+
TYPE_NONE = 126
|
79
|
+
|
80
|
+
# Port not empty and type is invalid
|
81
|
+
TYPE_ERROR = 127
|
82
|
+
|
83
|
+
# enum: SLOT
|
84
|
+
# Program ID's (Slots)
|
85
|
+
|
86
|
+
# Program slot reserved for executing the user interface
|
87
|
+
GUI_SLOT = 0
|
88
|
+
|
89
|
+
# Program slot used to execute user projects, apps and tools
|
90
|
+
USER_SLOT = 1
|
91
|
+
|
92
|
+
# Program slot used for direct commands coming from c_com
|
93
|
+
CMD_SLOT = 2
|
94
|
+
|
95
|
+
# Program slot used for direct commands coming from c_ui
|
96
|
+
TERM_SLOT = 3
|
97
|
+
|
98
|
+
# Program slot used to run the debug ui
|
99
|
+
DEBUG_SLOT = 4
|
100
|
+
|
101
|
+
# Maximum slots supported by the VM
|
102
|
+
SLOTS = 5
|
103
|
+
|
104
|
+
CURRENT_SLOT = -1
|
105
|
+
|
106
|
+
# enum: BUTTONTYPE
|
107
|
+
# Button
|
108
|
+
|
109
|
+
NO_BUTTON = 0
|
110
|
+
|
111
|
+
UP_BUTTON = 1
|
112
|
+
|
113
|
+
ENTER_BUTTON = 2
|
114
|
+
|
115
|
+
DOWN_BUTTON = 3
|
116
|
+
|
117
|
+
RIGHT_BUTTON = 4
|
118
|
+
|
119
|
+
LEFT_BUTTON = 5
|
120
|
+
|
121
|
+
BACK_BUTTON = 6
|
122
|
+
|
123
|
+
ANY_BUTTON = 7
|
124
|
+
|
125
|
+
BUTTONTYPES = 8
|
126
|
+
|
127
|
+
# enum: BROWSERTYPE
|
128
|
+
# Browser Types Avaliable
|
129
|
+
|
130
|
+
# Browser for folders
|
131
|
+
BROWSE_FOLDERS = 0
|
132
|
+
|
133
|
+
# Browser for folders and files
|
134
|
+
BROWSE_FOLDS_FILES = 1
|
135
|
+
|
136
|
+
# Browser for cached / recent files
|
137
|
+
BROWSE_CACHE = 2
|
138
|
+
|
139
|
+
# Browser for files
|
140
|
+
BROWSE_FILES = 3
|
141
|
+
|
142
|
+
# Maximum browser types supported by the VM
|
143
|
+
BROWSERTYPES = 4
|
144
|
+
|
145
|
+
# enum: FONTTYPE
|
146
|
+
# Font Types Avaliable
|
147
|
+
|
148
|
+
NORMAL_FONT = 0
|
149
|
+
|
150
|
+
SMALL_FONT = 1
|
151
|
+
|
152
|
+
LARGE_FONT = 2
|
153
|
+
|
154
|
+
TINY_FONT = 3
|
155
|
+
|
156
|
+
# Maximum font types supported by the VM
|
157
|
+
FONTTYPES = 4
|
158
|
+
|
159
|
+
# enum: ICONTYPE
|
160
|
+
# Icon Types Avaliable
|
161
|
+
|
162
|
+
# 24x12_Files_Folders_Settings.bmp
|
163
|
+
NORMAL_ICON = 0
|
164
|
+
|
165
|
+
SMALL_ICON = 1
|
166
|
+
|
167
|
+
# 24x22_Yes_No_OFF_FILEOps.bmp
|
168
|
+
LARGE_ICON = 2
|
169
|
+
|
170
|
+
MENU_ICON = 3
|
171
|
+
|
172
|
+
# 8x12_miniArrows.bmp
|
173
|
+
ARROW_ICON = 4
|
174
|
+
|
175
|
+
# Maximum icon types supported by the VM
|
176
|
+
ICONTYPES = 5
|
177
|
+
|
178
|
+
# enum: S_ICON_NO
|
179
|
+
|
180
|
+
SICON_CHARGING = 0
|
181
|
+
|
182
|
+
SICON_BATT_4 = 1
|
183
|
+
|
184
|
+
SICON_BATT_3 = 2
|
185
|
+
|
186
|
+
SICON_BATT_2 = 3
|
187
|
+
|
188
|
+
SICON_BATT_1 = 4
|
189
|
+
|
190
|
+
SICON_BATT_0 = 5
|
191
|
+
|
192
|
+
SICON_WAIT1 = 6
|
193
|
+
|
194
|
+
SICON_WAIT2 = 7
|
195
|
+
|
196
|
+
SICON_BT_ON = 8
|
197
|
+
|
198
|
+
SICON_BT_VISIBLE = 9
|
199
|
+
|
200
|
+
SICON_BT_CONNECTED = 10
|
201
|
+
|
202
|
+
SICON_BT_CONNVISIB = 11
|
203
|
+
|
204
|
+
SICON_WIFI_3 = 12
|
205
|
+
|
206
|
+
SICON_WIFI_2 = 13
|
207
|
+
|
208
|
+
SICON_WIFI_1 = 14
|
209
|
+
|
210
|
+
SICON_WIFI_CONNECTED = 15
|
211
|
+
|
212
|
+
SICON_USB = 21
|
213
|
+
|
214
|
+
S_ICON_NOS = 22
|
215
|
+
|
216
|
+
# enum: N_ICON_NO
|
217
|
+
|
218
|
+
ICON_NONE = -1
|
219
|
+
|
220
|
+
ICON_RUN = 0
|
221
|
+
|
222
|
+
ICON_FOLDER = 1
|
223
|
+
|
224
|
+
ICON_FOLDER2 = 2
|
225
|
+
|
226
|
+
ICON_USB = 3
|
227
|
+
|
228
|
+
ICON_SD = 4
|
229
|
+
|
230
|
+
ICON_SOUND = 5
|
231
|
+
|
232
|
+
ICON_IMAGE = 6
|
233
|
+
|
234
|
+
ICON_SETTINGS = 7
|
235
|
+
|
236
|
+
ICON_ONOFF = 8
|
237
|
+
|
238
|
+
ICON_SEARCH = 9
|
239
|
+
|
240
|
+
ICON_WIFI = 10
|
241
|
+
|
242
|
+
ICON_CONNECTIONS = 11
|
243
|
+
|
244
|
+
ICON_ADD_HIDDEN = 12
|
245
|
+
|
246
|
+
ICON_TRASHBIN = 13
|
247
|
+
|
248
|
+
ICON_VISIBILITY = 14
|
249
|
+
|
250
|
+
ICON_KEY = 15
|
251
|
+
|
252
|
+
ICON_CONNECT = 16
|
253
|
+
|
254
|
+
ICON_DISCONNECT = 17
|
255
|
+
|
256
|
+
ICON_UP = 18
|
257
|
+
|
258
|
+
ICON_DOWN = 19
|
259
|
+
|
260
|
+
ICON_WAIT1 = 20
|
261
|
+
|
262
|
+
ICON_WAIT2 = 21
|
263
|
+
|
264
|
+
ICON_BLUETOOTH = 22
|
265
|
+
|
266
|
+
ICON_INFO = 23
|
267
|
+
|
268
|
+
ICON_TEXT = 24
|
269
|
+
|
270
|
+
ICON_QUESTIONMARK = 27
|
271
|
+
|
272
|
+
ICON_INFO_FILE = 28
|
273
|
+
|
274
|
+
ICON_DISC = 29
|
275
|
+
|
276
|
+
ICON_CONNECTED = 30
|
277
|
+
|
278
|
+
ICON_OBP = 31
|
279
|
+
|
280
|
+
ICON_OBD = 32
|
281
|
+
|
282
|
+
ICON_OPENFOLDER = 33
|
283
|
+
|
284
|
+
ICON_BRICK1 = 34
|
285
|
+
|
286
|
+
N_ICON_NOS = 35
|
287
|
+
|
288
|
+
# enum: L_ICON_NO
|
289
|
+
|
290
|
+
YES_NOTSEL = 0
|
291
|
+
|
292
|
+
YES_SEL = 1
|
293
|
+
|
294
|
+
NO_NOTSEL = 2
|
295
|
+
|
296
|
+
NO_SEL = 3
|
297
|
+
|
298
|
+
OFF = 4
|
299
|
+
|
300
|
+
WAIT_VERT = 5
|
301
|
+
|
302
|
+
WAIT_HORZ = 6
|
303
|
+
|
304
|
+
TO_MANUAL = 7
|
305
|
+
|
306
|
+
WARNSIGN = 8
|
307
|
+
|
308
|
+
WARN_BATT = 9
|
309
|
+
|
310
|
+
WARN_POWER = 10
|
311
|
+
|
312
|
+
WARN_TEMP = 11
|
313
|
+
|
314
|
+
NO_USBSTICK = 12
|
315
|
+
|
316
|
+
TO_EXECUTE = 13
|
317
|
+
|
318
|
+
TO_BRICK = 14
|
319
|
+
|
320
|
+
TO_SDCARD = 15
|
321
|
+
|
322
|
+
TO_USBSTICK = 16
|
323
|
+
|
324
|
+
TO_BLUETOOTH = 17
|
325
|
+
|
326
|
+
TO_WIFI = 18
|
327
|
+
|
328
|
+
TO_TRASH = 19
|
329
|
+
|
330
|
+
TO_COPY = 20
|
331
|
+
|
332
|
+
TO_FILE = 21
|
333
|
+
|
334
|
+
CHAR_ERROR = 22
|
335
|
+
|
336
|
+
COPY_ERROR = 23
|
337
|
+
|
338
|
+
PROGRAM_ERROR = 24
|
339
|
+
|
340
|
+
WARN_MEMORY = 27
|
341
|
+
|
342
|
+
L_ICON_NOS = 28
|
343
|
+
|
344
|
+
# enum: M_ICON_NO
|
345
|
+
|
346
|
+
ICON_STAR = 0
|
347
|
+
|
348
|
+
ICON_LOCKSTAR = 1
|
349
|
+
|
350
|
+
ICON_LOCK = 2
|
351
|
+
|
352
|
+
# Bluetooth type PC
|
353
|
+
ICON_PC = 3
|
354
|
+
|
355
|
+
# Bluetooth type PHONE
|
356
|
+
ICON_PHONE = 4
|
357
|
+
|
358
|
+
# Bluetooth type BRICK
|
359
|
+
ICON_BRICK = 5
|
360
|
+
|
361
|
+
# Bluetooth type UNKNOWN
|
362
|
+
ICON_UNKNOWN = 6
|
363
|
+
|
364
|
+
ICON_FROM_FOLDER = 7
|
365
|
+
|
366
|
+
ICON_CHECKBOX = 8
|
367
|
+
|
368
|
+
ICON_CHECKED = 9
|
369
|
+
|
370
|
+
ICON_XED = 10
|
371
|
+
|
372
|
+
M_ICON_NOS = 11
|
373
|
+
|
374
|
+
# enum: A_ICON_NO
|
375
|
+
|
376
|
+
ICON_LEFT = 1
|
377
|
+
|
378
|
+
ICON_RIGHT = 2
|
379
|
+
|
380
|
+
A_ICON_NOS = 3
|
381
|
+
|
382
|
+
# enum: BTTYPE
|
383
|
+
# Bluetooth Device Types
|
384
|
+
|
385
|
+
# Bluetooth type PC
|
386
|
+
BTTYPE_PC = 3
|
387
|
+
|
388
|
+
# Bluetooth type PHONE
|
389
|
+
BTTYPE_PHONE = 4
|
390
|
+
|
391
|
+
# Bluetooth type BRICK
|
392
|
+
BTTYPE_BRICK = 5
|
393
|
+
|
394
|
+
# Bluetooth type UNKNOWN
|
395
|
+
BTTYPE_UNKNOWN = 6
|
396
|
+
|
397
|
+
BTTYPES = 7
|
398
|
+
|
399
|
+
# enum: LEDPATTERN
|
400
|
+
# LED Pattern
|
401
|
+
|
402
|
+
LED_BLACK = 0
|
403
|
+
|
404
|
+
LED_GREEN = 1
|
405
|
+
|
406
|
+
LED_RED = 2
|
407
|
+
|
408
|
+
LED_ORANGE = 3
|
409
|
+
|
410
|
+
LED_GREEN_FLASH = 4
|
411
|
+
|
412
|
+
LED_RED_FLASH = 5
|
413
|
+
|
414
|
+
LED_ORANGE_FLASH = 6
|
415
|
+
|
416
|
+
LED_GREEN_PULSE = 7
|
417
|
+
|
418
|
+
LED_RED_PULSE = 8
|
419
|
+
|
420
|
+
LED_ORANGE_PULSE = 9
|
421
|
+
|
422
|
+
LEDPATTERNS = 10
|
423
|
+
|
424
|
+
# enum: LEDTYPE
|
425
|
+
|
426
|
+
# All LEDs
|
427
|
+
LED_ALL = 0
|
428
|
+
|
429
|
+
# Right red
|
430
|
+
LED_RR = 1
|
431
|
+
|
432
|
+
# Right green
|
433
|
+
LED_RG = 2
|
434
|
+
|
435
|
+
# Left red
|
436
|
+
LED_LR = 3
|
437
|
+
|
438
|
+
# Left green
|
439
|
+
LED_LG = 4
|
440
|
+
|
441
|
+
# enum: FILETYPE
|
442
|
+
# File Types Avaliable
|
443
|
+
|
444
|
+
FILETYPE_UNKNOWN = 0
|
445
|
+
|
446
|
+
TYPE_FOLDER = 1
|
447
|
+
|
448
|
+
TYPE_SOUND = 2
|
449
|
+
|
450
|
+
TYPE_BYTECODE = 3
|
451
|
+
|
452
|
+
TYPE_GRAPHICS = 4
|
453
|
+
|
454
|
+
TYPE_DATALOG = 5
|
455
|
+
|
456
|
+
TYPE_PROGRAM = 6
|
457
|
+
|
458
|
+
TYPE_TEXT = 7
|
459
|
+
|
460
|
+
TYPE_SDCARD = 16
|
461
|
+
|
462
|
+
TYPE_USBSTICK = 32
|
463
|
+
|
464
|
+
FILETYPES = 33
|
465
|
+
|
466
|
+
TYPE_RESTART_BROWSER = -1
|
467
|
+
|
468
|
+
TYPE_REFRESH_BROWSER = -2
|
469
|
+
|
470
|
+
# enum: RESULT
|
471
|
+
# Describes result from executing functions
|
472
|
+
|
473
|
+
# No errors to report
|
474
|
+
OK = 0
|
475
|
+
|
476
|
+
# Busy - try again
|
477
|
+
BUSY = 1
|
478
|
+
|
479
|
+
# Something failed
|
480
|
+
FAIL = 2
|
481
|
+
|
482
|
+
# Stopped
|
483
|
+
STOP = 4
|
484
|
+
|
485
|
+
# Start
|
486
|
+
START = 8
|
487
|
+
|
488
|
+
# enum: DATA_FORMAT
|
489
|
+
# Data formats used in device type formats
|
490
|
+
|
491
|
+
# DATA8
|
492
|
+
DATA_8 = 0
|
493
|
+
|
494
|
+
# DATA16
|
495
|
+
DATA_16 = 1
|
496
|
+
|
497
|
+
# DATA32
|
498
|
+
DATA_32 = 2
|
499
|
+
|
500
|
+
# DATAF
|
501
|
+
DATA_F = 3
|
502
|
+
|
503
|
+
# Zero terminated string
|
504
|
+
DATA_S = 4
|
505
|
+
|
506
|
+
# Array handle
|
507
|
+
DATA_A = 5
|
508
|
+
|
509
|
+
# Variable type
|
510
|
+
DATA_V = 7
|
511
|
+
|
512
|
+
# Percent
|
513
|
+
DATA_PCT = 16
|
514
|
+
|
515
|
+
# Raw
|
516
|
+
DATA_RAW = 18
|
517
|
+
|
518
|
+
# SI unit
|
519
|
+
DATA_SI = 19
|
520
|
+
|
521
|
+
DATA_FORMATS = 20
|
522
|
+
|
523
|
+
# enum: DEL
|
524
|
+
# Delimiter codes used to define how data is separated in files
|
525
|
+
|
526
|
+
# No delimiter at all
|
527
|
+
DEL_NONE = 0
|
528
|
+
|
529
|
+
# Use tab as delimiter
|
530
|
+
DEL_TAB = 1
|
531
|
+
|
532
|
+
# Use space as delimiter
|
533
|
+
DEL_SPACE = 2
|
534
|
+
|
535
|
+
# Use return as delimiter
|
536
|
+
DEL_RETURN = 3
|
537
|
+
|
538
|
+
# Use colon as delimiter
|
539
|
+
DEL_COLON = 4
|
540
|
+
|
541
|
+
# Use comma as delimiter
|
542
|
+
DEL_COMMA = 5
|
543
|
+
|
544
|
+
# Use line feed as delimiter
|
545
|
+
DEL_LINEFEED = 6
|
546
|
+
|
547
|
+
# Use return+line feed as delimiter
|
548
|
+
DEL_CRLF = 7
|
549
|
+
|
550
|
+
DELS = 8
|
551
|
+
|
552
|
+
# enum: HWTYPE
|
553
|
+
# Hardware Transport Layer
|
554
|
+
|
555
|
+
HW_USB = 1
|
556
|
+
|
557
|
+
HW_BT = 2
|
558
|
+
|
559
|
+
HW_WIFI = 3
|
560
|
+
|
561
|
+
HWTYPES = 4
|
562
|
+
|
563
|
+
# enum: ENCRYPT
|
564
|
+
# Encryption Types
|
565
|
+
|
566
|
+
ENCRYPT_NONE = 0
|
567
|
+
|
568
|
+
ENCRYPT_WPA2 = 1
|
569
|
+
|
570
|
+
ENCRYPTS = 2
|
571
|
+
|
572
|
+
# enum: LMS_ENCRYPT
|
573
|
+
# Encryption Types
|
574
|
+
|
575
|
+
LMS_ENCRYPT_NONE = 0
|
576
|
+
|
577
|
+
LMS_ENCRYPT_WPA2 = 1
|
578
|
+
|
579
|
+
LMS_ENCRYPTS = 2
|
580
|
+
|
581
|
+
# enum: COLOR
|
582
|
+
|
583
|
+
RED = 0
|
584
|
+
|
585
|
+
GREEN = 1
|
586
|
+
|
587
|
+
BLUE = 2
|
588
|
+
|
589
|
+
BLANK = 3
|
590
|
+
|
591
|
+
COLORS = 4
|
592
|
+
|
593
|
+
# enum: NXTCOLOR
|
594
|
+
# Constants related to color sensor value using Color sensor as color detector
|
595
|
+
|
596
|
+
BLACKCOLOR = 1
|
597
|
+
|
598
|
+
BLUECOLOR = 2
|
599
|
+
|
600
|
+
GREENCOLOR = 3
|
601
|
+
|
602
|
+
YELLOWCOLOR = 4
|
603
|
+
|
604
|
+
REDCOLOR = 5
|
605
|
+
|
606
|
+
WHITECOLOR = 6
|
607
|
+
|
608
|
+
# enum: WARNING
|
609
|
+
# Warnings
|
610
|
+
|
611
|
+
WARNING_TEMP = 1
|
612
|
+
|
613
|
+
WARNING_CURRENT = 2
|
614
|
+
|
615
|
+
WARNING_VOLTAGE = 4
|
616
|
+
|
617
|
+
WARNING_MEMORY = 8
|
618
|
+
|
619
|
+
WARNING_DSPSTAT = 16
|
620
|
+
|
621
|
+
WARNING_RAM = 32
|
622
|
+
|
623
|
+
WARNING_BATTLOW = 64
|
624
|
+
|
625
|
+
WARNING_BUSY = 128
|
626
|
+
|
627
|
+
WARNINGS = 63
|
628
|
+
|
629
|
+
# enum: OBJSTAT
|
630
|
+
# Values used to describe an object's status
|
631
|
+
|
632
|
+
# Object code is running
|
633
|
+
RUNNING = 16
|
634
|
+
|
635
|
+
# Object is waiting for final trigger
|
636
|
+
WAITING = 32
|
637
|
+
|
638
|
+
# Object is stopped or not triggered yet
|
639
|
+
STOPPED = 64
|
640
|
+
|
641
|
+
# Object is halted because a call is in progress
|
642
|
+
HALTED = 128
|
643
|
+
|
644
|
+
# enum: DEVCMD
|
645
|
+
# Device commands used to control (UART sensors) devices
|
646
|
+
|
647
|
+
# UART device reset
|
648
|
+
DEVCMD_RESET = 17
|
649
|
+
|
650
|
+
# UART device fire (ultrasonic)
|
651
|
+
DEVCMD_FIRE = 17
|
652
|
+
|
653
|
+
# UART device channel (IR seeker)
|
654
|
+
DEVCMD_CHANNEL = 18
|
655
|
+
|
656
|
+
DEVCMDS = 19
|
657
|
+
|
658
|
+
# .
|
659
|
+
end
|