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
|
# File 'lib/fusuma/plugin/parsers/touch_parser.rb', line 11
def parse_record(record)
MultiLogger.debug("#{self.class.name}##{__method__}")
MultiLogger.debug(" record = #{record.inspect}")
case record.to_s
when /TOUCH_DOWN\s+\+(\d+\.\d+)s\s+(\d+)\s+\(\d+\)\s+(\d+\.\d+)\/(\d+\.\d+)\s+\((\d+\.\d+)\/(\d+\.\d+)mm\)/
status = 'begin'
time_offset = $1
finger = $2
x_px = $3
y_px = $4
x_mm = $5
y_mm = $6
when /TOUCH_MOTION\s+\+(\d+\.\d+)s\s+(\d+)\s+\(\d+\)\s+(\d+\.\d+)\/(\d+\.\d+)\s+\((\d+\.\d+)\/(\d+\.\d+)mm\)/
status = 'update'
time_offset = $1
finger = $2
x_px = $3
y_px = $4
x_mm = $5
y_mm = $6
when /TOUCH_UP\s+\+(\d+\.\d+)s\s+(\d+)\s+\(\d+\)/
status = 'end'
time_offset = $1
finger = $2
else
return
end
Events::Records::TouchRecord.new(status: status,
finger: finger,
time_offset: time_offset,
x_px: x_px,
y_px: y_px,
x_mm: x_mm,
y_mm: y_mm)
end
|