395
395
function Visca .PayloadReply :get_inquiry_data_for (inquiry_payload )
396
396
local _ ,_ ,category ,inquiry_command = unpack (inquiry_payload )
397
397
local data = {}
398
+ local unsupported_nr_of_arguments = false
398
399
399
400
if category == Visca .categories .interface then
400
401
if inquiry_command == Visca .inquiry_commands .software_version then
@@ -410,25 +411,39 @@ function Visca.PayloadReply:get_inquiry_data_for(inquiry_payload)
410
411
rom_version = bit .lshift (self .arguments [5 ] or 0 , 8 ) + (self .arguments [6 ] or 0 ),
411
412
max_nr_sockets = bit .band (self .arguments [7 ] or 0 , 0x0F ),
412
413
}
414
+ else
415
+ unsupported_nr_of_arguments = true
413
416
end
414
417
end
415
418
elseif category == Visca .categories .camera then
416
419
if inquiry_command == Visca .inquiry_commands .color_gain then
417
- data = {
418
- color_level = bit .band (self .arguments [4 ] or 0 , 0x0F )
419
- }
420
+ if self .argument_cnt == 4 then
421
+ data = {
422
+ color_level = bit .band (self .arguments [4 ] or 0 , 0x0F )
423
+ }
424
+ else
425
+ unsupported_nr_of_arguments = true
426
+ end
420
427
elseif inquiry_command == Visca .inquiry_commands .brightness_position then
421
- data = {
422
- brightness = bit .lshift (bit .band (self .arguments [3 ] or 0 , 0x0F ), 4 ) +
423
- bit .band (self .arguments [4 ] or 0 , 0x0F ),
424
- }
428
+ if self .argument_cnt == 4 then
429
+ data = {
430
+ brightness = bit .lshift (bit .band (self .arguments [3 ] or 0 , 0x0F ), 4 ) +
431
+ bit .band (self .arguments [4 ] or 0 , 0x0F ),
432
+ }
433
+ else
434
+ unsupported_nr_of_arguments = true
435
+ end
425
436
elseif inquiry_command == Visca .inquiry_commands .zoom_position then
426
- data = {
427
- zoom = bit .lshift (bit .band (self .arguments [1 ] or 0 , 0x0F ), 12 ) +
428
- bit .lshift (bit .band (self .arguments [2 ] or 0 , 0x0F ), 8 ) +
429
- bit .lshift (bit .band (self .arguments [3 ] or 0 , 0x0F ), 4 ) +
430
- bit .band (self .arguments [4 ] or 0 , 0x0F ),
431
- }
437
+ if self .argument_cnt == 4 then
438
+ data = {
439
+ zoom = bit .lshift (bit .band (self .arguments [1 ] or 0 , 0x0F ), 12 ) +
440
+ bit .lshift (bit .band (self .arguments [2 ] or 0 , 0x0F ), 8 ) +
441
+ bit .lshift (bit .band (self .arguments [3 ] or 0 , 0x0F ), 4 ) +
442
+ bit .band (self .arguments [4 ] or 0 , 0x0F ),
443
+ }
444
+ else
445
+ unsupported_nr_of_arguments = true
446
+ end
432
447
end
433
448
elseif category == Visca .categories .pan_tilter then
434
449
if inquiry_command == Visca .inquiry_commands .pantilt_position then
@@ -457,6 +472,20 @@ function Visca.PayloadReply:get_inquiry_data_for(inquiry_payload)
457
472
bit .lshift (bit .band (self .arguments [8 ] or 0 , 0x0F ), 4 ) +
458
473
bit .band (self .arguments [9 ] or 0 , 0x0F )
459
474
}
475
+ else
476
+ unsupported_nr_of_arguments = true
477
+ end
478
+ end
479
+ end
480
+
481
+ if next (data ) == nil then
482
+ if Visca .debug then
483
+ if unsupported_nr_of_arguments then
484
+ print (string.format (" Unsupported number of arguments received for inquiry %d (%d)" ,
485
+ inquiry_command , self .argument_cnt ))
486
+ else
487
+ print (string.format (" Unsupported inquiry type received (%d) for command category %d" ,
488
+ inquiry_command , category ))
460
489
end
461
490
end
462
491
end
0 commit comments