Scriptel ScripTouch ProScript C Library This documentation contains information about the ScripTouch ProScript C Library.

example-connecting.c

This is a simple example demonstrating how to enumerate and connect to a ScripTouch device.

#include <stdio.h>
#include "scriptel-proscript.h"
int main() {
scriptel_device* device;
//Initialize the library.
scriptel_init();
//List the devices.
if(scriptel_list_devices(&device) == SCRIPTEL_CODE_SUCCESS) {
//Test to see if we have more than zero devices.
if(device != NULL) {
printf("Found %i devices.\n", scriptel_count_device_list(device));
//Lets open the first device and get some information from it.
if(scriptel_open_device(device) == SCRIPTEL_CODE_SUCCESS) {
printf("Successfully connected to %s - %s at: %s\n", device->manufacturer, device->model, device->path);
scriptel_print_device_uuid(scriptel_get_device_uuid(device));
scriptel_close_device(device);
scriptel_free_device_list(device);
} else {
printf("Problem opening device: %s\n", scriptel_get_last_error());
return 1;
}
} else {
printf("No devices found!\n");
return 2;
}
} else {
printf("Problem enumerating devices: %s\n", scriptel_get_last_error());
return 3;
}
}
scriptel-proscript.h
This file contains the headers for the core of the Scriptel ScripTouch ProScript library.
scriptel_init
void scriptel_init(void)
This function should be called prior to using any other library functions.
scriptel_count_device_list
unsigned int scriptel_count_device_list(scriptel_device *list)
This function counts the number of devices in a given device list.
scriptel_get_device_uuid
unsigned char * scriptel_get_device_uuid(scriptel_device *device)
This function returns the UUID of a device as a byte array.
scriptel_list_devices
scriptel_error_code scriptel_list_devices(scriptel_device **start)
This function takes a pointer and will attempt to enumerate any attached ScripTouch devices.
scriptel_close_device
scriptel_error_code scriptel_close_device(scriptel_device *device)
This function attempts to close a local device that was previously opened.
scriptel_open_device
scriptel_error_code scriptel_open_device(scriptel_device *device)
This function attempts to open a local device returned by scriptel_list_devices().
scriptel_get_last_error
char * scriptel_get_last_error(void)
This function gets the last error message generated by the library.
scriptel_free_device_list
void scriptel_free_device_list(scriptel_device *device_list)
This function crawls a scriptel_device list and attempts to free any library managed memory associate...
SCRIPTEL_CODE_SUCCESS
@ SCRIPTEL_CODE_SUCCESS
This code indicates that the function did succeed.
Definition: scriptel-proscript.h:96
scriptel_print_device_uuid
void scriptel_print_device_uuid(unsigned char *uuid)
This function prints a UUID byte array to standard out.
scriptel_device
This structure represents a physically attached Scriptel ScripTouch device.
Definition: scriptel-proscript.h:284
scriptel_device::path
char * path
The path to the device.
Definition: scriptel-proscript.h:290
scriptel_device::model
char * model
The textual name of the device as returned by the operating system's HID driver.
Definition: scriptel-proscript.h:305
scriptel_device::manufacturer
char * manufacturer
The textual name of the manufacturer as returned by the operating system's HID driver.
Definition: scriptel-proscript.h:310