<< hid_read_timeout HID Basic's commands hid_write >>

USB Comunication Toolbox for Scilab >> HIDAPI Library > HID Basic's commands > hid_set_nonblocking

hid_set_nonblocking

Block or unblock the reading process

Calling Sequence

nonblocking_success=hid_set_nonblocking(_block);

Parameters

_block
: Boolean entry. Use %t or %T to unblocked the reading process. Use %f or %F to blocked the reading process.
nonblocking_success
: retun 0 if device' s handle has been set the non blocking feacture and -1 if the device' s handle non blocking feacture can not be set.

Description

Set the non blocking state to the device's handle

With this function the user can activate or deactivate the non blocking feacture of the reading proccess. If the feacture is deactivate the reading process will not wait for data in the usb port to be read. Otherwise the reading process wait until the data arrive to the respective usb port.

Examples

n=5;
txBuff=init_buff(n);
for i=1:n
    txBuff=setBuffValue(txBuff,i,i);
end
VendorID="04D8";
ProductID="010B";
VendorID=uint16(hex2dec(VendorID));
ProductID=uint16(hex2dec(ProductID));
init_success=hid_init();
if ( init_success < 0 ) then
   disp("unable to initialize the HIDAPI Library");
   return
else
   disp("HIDAPI Library initialized");
end
open_success=hid_open(VendorID,ProductID);
if ( open_success < 0 ) then
   disp("unable to open device");
   return
else
   disp("device open");
end
nonblocking_success=hid_set_nonblocking(%t);
if ( nonblocking_success < 0 ) then
   disp("unable to set nonblocking");
else
   disp("device have been set nonblocking");
end
close_success=hid_close();  
if ( close_success < 0 ) then
   disp("unable to closed device");
else
   disp("device closed");
end
exit_success=hid_exit();
if ( init_success < 0 ) then
   disp("unable to free static data associated with HIDAPI Library");
   return
else
   disp("HIDAPI Library have been freed all of the static data associated");
end

See Also

Authors

<< hid_read_timeout HID Basic's commands hid_write >>