Public Class methods
cached_count -> integer
Return number of cached devices.
static VALUE rb_blink1_getCachedCount(VALUE self) { return INT2NUM(blink1_getCachedCount()); }
cached_path (index) -> string
Return cached device path by index.
static VALUE rb_blink1_blink1_getCachedPath(VALUE self, VALUE i) { return rb_str_new2(blink1_getCachedPath(FIX2INT(i))); }
cached_serial (index) -> string
Return cached device serial id by index.
static VALUE rb_blink1_getCachedSerial(VALUE self, VALUE i) { const wchar_t *ret = blink1_getCachedSerial(FIX2INT(i)); char dest[16] = {"\0"}; int t = wcstombs(dest, ret, sizeof(ret)); return rb_str_new2(dest); }
degamma (p1)
Return gamma corrected value for a RGB component.
static VALUE rb_blink1_degamma(VALUE self, VALUE i) { return INT2NUM(blink1_degamma(FIX2INT(i))); }
degamma_enabled ()
Return degamma enabled.
static VALUE rb_blink1_getDegammaEnabled(VALUE self) { return degamma == 1 ? Qtrue : Qfalse; }
degamma_enabled= (p1)
Set degamma enabled.
static VALUE rb_blink1_setDegammaEnabled(VALUE self, VALUE enabled) { if(RTEST(enabled)) { degamma = 1; blink1_enableDegamma(); } else { degamma = 0; blink1_disableDegamma(); } return Qnil; }
enumerate ()
Get all devices by default product_id
, vendor_id
.
static VALUE rb_blink1_enumerate(VALUE self) { return INT2NUM(blink1_enumerate()); }
enumerate_by_vid_pid (vid, pid) -> integer
Get all matching devices by VID/PID pair.
Return number of devices.
static VALUE rb_blink1_enumerateByVidPid(VALUE self, VALUE vid, VALUE pid) { return INT2NUM(blink1_enumerateByVidPid(FIX2INT(vid), FIX2INT(pid))); }
list ()
Returns array of hash with keys :id
, :serial
,
:path
new ( {Fixnum} id )
new ( {Boolean} auto_open )
new ( {String} serial_id )
new ( :path => device_path )
new ( :serial => serial_id )
Returns new instance of Blink1
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
def initialize option = nil case option when Fixnum open_by_id(option) when Hash path = option[:path] || option["path"] serial = option[:serial] || option["serial"] if path open_by_path(path) elsif serial open_by_serial(serial) end when String open_by_serial(option) else open if option == true end @millis ||= 300 @delay_millis ||= 500 end |
open ( {Fixnum} id ) { |blink1| }
open ( {Boolean} autoopen ) { |blink1| }
open ( {String} serial_id ) { |blink1| }
open ( :path => device_path ) { |blink1| }
open ( :serial => serial_id ) { |blink1| }
If block given, yieds new instance of Blink1
.
If not, returns new Blink1
product_id ()
Return product ID
static VALUE rb_blink1_pid(VALUE self) { return INT2NUM(blink1_pid()); }
sleep (p1)
Sleeps for milliseconds.
static VALUE rb_blink1_sleep(VALUE self, VALUE delayMillis) { blink1_sleep(FIX2UINT(delayMillis)); return Qnil; }
sort_paths ()
Sort cached device by path.
static VALUE rb_blink1_sortPaths(VALUE self) { blink1_sortPaths(); return Qnil; }
sort_serials ()
Sort cached device by serial id.
static VALUE rb_blink1_sortSerials(VALUE self) { blink1_sortSerials(); return Qnil; }
vendor_id ()
Return vendor ID
static VALUE rb_blink1_vid(VALUE self) { return INT2NUM(blink1_vid()); }