smartware 0.1.25 → 0.1.26
Sign up to get free protection for your applications and to get access to all the features.
@@ -28,7 +28,6 @@ module Smartware
|
|
28
28
|
|
29
29
|
def model
|
30
30
|
model_code = send "\x1DI1"
|
31
|
-
rom_version = send "\x1DI3", false
|
32
31
|
model_name = case model_code
|
33
32
|
when "a7" then 'Custom TG2460H'
|
34
33
|
when "a8" then 'Custom TG2480H'
|
@@ -36,11 +35,15 @@ module Smartware
|
|
36
35
|
when "ad" then 'Custom TL60'
|
37
36
|
else 'Unknown printer'
|
38
37
|
end
|
39
|
-
|
38
|
+
model_name
|
40
39
|
rescue
|
41
40
|
-1
|
42
41
|
end
|
43
42
|
|
43
|
+
def version
|
44
|
+
send "\x1DI3", false
|
45
|
+
end
|
46
|
+
|
44
47
|
private
|
45
48
|
def send(message, parse_answer = true)
|
46
49
|
@sp.write message
|
@@ -19,6 +19,7 @@ module Smartware
|
|
19
19
|
@configured = true
|
20
20
|
rescue => e
|
21
21
|
@configured = false
|
22
|
+
Smartware::Logging.logger.error "Printer initialization failed: #{e.to_s}"
|
22
23
|
end
|
23
24
|
|
24
25
|
def self.configured?
|
@@ -49,20 +50,20 @@ module Smartware
|
|
49
50
|
def self.start_monitor!
|
50
51
|
t = Thread.new do
|
51
52
|
loop do
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
rescue => e
|
63
|
-
Smartware::Logging.logger.error e.message
|
64
|
-
Smartware::Logging.logger.error e.backtrace.join("\n")
|
53
|
+
begin
|
54
|
+
if @queue.empty?
|
55
|
+
@status[:error] = @device.error || ''
|
56
|
+
@status[:model] = @device.model
|
57
|
+
@status[:version] = @device.version
|
58
|
+
else
|
59
|
+
`lpr #{@queue[0]}`
|
60
|
+
Smartware::Logging.logger.info "Printed #{@queue[0]}"
|
61
|
+
@queue.shift
|
62
|
+
sleep 5
|
65
63
|
end
|
64
|
+
rescue => e
|
65
|
+
Smartware::Logging.logger.error e.message
|
66
|
+
Smartware::Logging.logger.error e.backtrace.join("\n")
|
66
67
|
end
|
67
68
|
sleep 0.2
|
68
69
|
end
|
data/lib/smartware/service.rb
CHANGED
data/lib/smartware/version.rb
CHANGED