Class: BetaBrite::USB

Inherits:
Base
  • Object
show all
Defined in:
lib/betabrite/usb.rb

Constant Summary collapse

PRODUCT_ID =

USB Device Codes

0x1234
VENDOR_ID =
0x8765
INTERFACE =
0x00
RECV_LENGTH =

Max Packet Size of 64

0x40
SEND_LENGTH =

Max Packet Size of 64

0x40
WRITE_ENDPOINT =
0x02
READ_ENDPOINT =
0x82
WRITE_TIMEOUT =
5000
READ_TIMEOUT =
5000

Constants inherited from Base

Base::CR, Base::DLE, Base::EOT, Base::ESC, Base::ETX, Base::HEADER, Base::MEMORY_CODE, Base::SIGN_TYPE, Base::STRING, Base::STX

Instance Attribute Summary

Attributes inherited from Base

#dots_files, #memory, #sleep_time, #string_files, #text_files

Instance Method Summary collapse

Methods inherited from Base

#allocate, #clear_memory!, #dotsfile, #initialize, #memory_message, #message, #stringfile, #textfile

Constructor Details

This class inherits a constructor from BetaBrite::Base

Instance Method Details

#reset!Object



14
15
16
# File 'lib/betabrite/usb.rb', line 14

def reset!
  write_memory!
end

#write!Object



26
27
28
29
30
31
32
# File 'lib/betabrite/usb.rb', line 26

def write!
  device = usb_device()
  handle = usb_interface(device)
  handle.usb_bulk_write(WRITE_ENDPOINT, message, WRITE_TIMEOUT)
  handle.usb_bulk_write(WRITE_ENDPOINT, message, WRITE_TIMEOUT)
  handle.usb_close
end

#write_memory!Object



18
19
20
21
22
23
24
# File 'lib/betabrite/usb.rb', line 18

def write_memory!
  device = usb_device()
  handle = usb_interface(device)
  handle.usb_bulk_write(WRITE_ENDPOINT, memory_message, WRITE_TIMEOUT)
  handle.usb_bulk_write(WRITE_ENDPOINT, memory_message, WRITE_TIMEOUT)
  handle.usb_close
end