Skip to content

Commit 4019a14

Browse files
committed
The local HWBridge now does not print out status for each URI request per default. This can be enabled by setting verbose to true.
Signed-off-by: Craig Smith <[email protected]>
1 parent 36026ba commit 4019a14

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

modules/auxiliary/server/local_hwbridge.rb

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -228,33 +228,33 @@ def not_supported
228228

229229
def on_request_uri(cli, request)
230230
if request.uri =~ /status$/i
231-
print_status("Sending status...")
231+
print_status("Sending status...") if datastore['VERBOSE']
232232
send_response_html(cli, get_status().to_json(), { 'Content-Type' => 'application/json' })
233233
elsif request.uri =~ /statistics$/i
234-
print_status("Sending statistics...")
234+
print_status("Sending statistics...") if datastore['VERBOSE']
235235
send_response_html(cli, get_statistics().to_json(), { 'Content-Type' => 'application/json' })
236236
elsif request.uri =~ /settings\/datetime\/get$/i
237-
print_status("Sending Datetime")
237+
print_status("Sending Datetime") if datastore['VERBOSE']
238238
send_response_html(cli, get_datetime().to_json(), { 'Content-Type' => 'application/json' })
239239
elsif request.uri =~ /settings\/timezone\/get$/i
240-
print_status("Sending Timezone")
240+
print_status("Sending Timezone") if datastore['VERBOSE']
241241
send_response_html(cli, get_timezone().to_json(), { 'Content-Type' => 'application/json' })
242242
elsif request.uri =~ /custom_methods$/i
243-
print_status("Sending custom methods")
243+
print_status("Sending custom methods") if datastore['VERBOSE']
244244
send_response_html(cli, get_custom_methods().to_json(), { 'Content-Type' => 'application/json' })
245245
elsif request.uri =~ /custom\/sample_cmd\?data=(\S+)$/
246-
print_status("Request for custom command with args #{$1}")
246+
print_status("Request for custom command with args #{$1}") if datastore['VERBOSE']
247247
send_response_html(cli, sample_custom_method($1).to_json(), { 'Content-Type' => 'application/json' })
248248
elsif request.uri =~ /automotive/i
249249
if request.uri =~ /automotive\/supported_buses/
250-
print_status("Sending known buses...")
250+
print_status("Sending known buses...") if datastore['VERBOSE']
251251
send_response_html(cli, get_auto_supported_buses().to_json, { 'Content-Type' => 'application/json' })
252252
elsif request.uri =~ /automotive\/(\w+)\/cansend\?id=(\w+)&data=(\w+)/
253-
print_status("Request to send CAN packets for #{$1} => #{$2}##{$3}")
253+
print_status("Request to send CAN packets for #{$1} => #{$2}##{$3}") if datastore['VERBOSE']
254254
send_response_html(cli, cansend($1, $2, $3).to_json(), { 'Content-Type' => 'application/json' })
255255
elsif request.uri =~ /automotive\/(\w+)\/isotpsend_and_wait\?srcid=(\w+)&dstid=(\w+)&data=(\w+)/
256256
bus = $1; srcid = $2; dstid = $3; data = $4
257-
print_status("Request to send ISO-TP packet and wait for response #{srcid}##{data} => #{dstid}")
257+
print_status("Request to send ISO-TP packet and wait for response #{srcid}##{data} => #{dstid}") if datastore['VERBOSE']
258258
timeout = 1500
259259
maxpkts = 3
260260
timeout = $1 if request.uri =~ /&timeout=(\d+)/

0 commit comments

Comments
 (0)