Logo Search packages:      
Sourcecode: scanbuttond version File versions  Download package

int scanbtnd_get_button ( scanner_t scanner )

Queries the scanner's button status.

Parameters:
scannerthe scanner device
Returns:
the number of the currently pressed button, 0 if no button is currently pressed, or <0 if there was an error.
Return values:
-EINVALif the scanner device has not been opened before

Definition at line 208 of file artec_eplus48u.c.

{

  unsigned char bytes[64];
      int num_bytes;

      const unsigned char request_packet[64] = { 
            0x74, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
            0x74, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
            0x74, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
            0x74, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
            0x74, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
            0x74, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
            0x74, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
            0x74, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
      };   

      if (!scanner->is_open)
            return -EINVAL;

      // Send request
      num_bytes = artec_control_msg(scanner,
            0x40, 0x01, 0x2012, 0x3f40, (void *)request_packet, 64);
      if (num_bytes < 0) return 0;

      // Get response
      num_bytes = artec_control_msg(scanner,
            0xc0, 0x01, 0x2013, 0x3f00, (void *)bytes, 64);
      if (num_bytes < 0) return 0;

      switch (bytes[2]) {
      case 0x08: // scan 
            return 1;
      case 0x02: // copy
            return 2;
      case 0x04: // ocr
            return 3;
      case 0x01: // email
            return 4;
      }
      return 0;
}

Generated by  Doxygen 1.6.0   Back to index