zaber.motion.Library Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of motion-library Show documentation
Show all versions of motion-library Show documentation
A library that aims to provide easy-to-use API for communication with Zaber devices using Zaber ASCII Protocol.
// ===== THIS FILE IS GENERATED FROM A TEMPLATE ===== //
// ============== DO NOT EDIT DIRECTLY ============== //
package zaber.motion;
import zaber.motion.protobufs.Main;
import zaber.motion.gateway.Call;
/**
* Access class to general library information and configuration.
*/
public final class Library {
private Library() {
}
/**
* Sets library logging output.
* @param mode Logging output mode.
* @param filePath Path of the file to open.
*/
public static void setLogOutput(
LogOutputMode mode, String filePath) {
Main.SetLogOutputRequest.Builder builder = Main.SetLogOutputRequest.newBuilder();
builder = builder.setMode(mode.getValue());
builder = builder.setFilePath(filePath);
Call.callSync("logging/set_output", builder.build(), null);
}
/**
* Sets library logging output.
* @param mode Logging output mode.
*/
public static void setLogOutput(
LogOutputMode mode) {
setLogOutput(mode, "");
}
/**
* Sets source of Device DB data. Allows selection of a web service or a local file.
* @param sourceType Source type.
* @param urlOrFilePath URL of the web service or path to the local file.
* Leave empty for the default URL of Zaber web service.
*/
public static void setDeviceDbSource(
DeviceDbSourceType sourceType, String urlOrFilePath) {
Main.SetDeviceDbSourceRequest.Builder builder = Main.SetDeviceDbSourceRequest.newBuilder();
builder = builder.setSourceType(sourceType.getValue());
builder = builder.setUrlOrFilePath(urlOrFilePath);
Call.callSync("device_db/set_source", builder.build(), null);
}
/**
* Sets source of Device DB data. Allows selection of a web service or a local file.
* @param sourceType Source type.
*/
public static void setDeviceDbSource(
DeviceDbSourceType sourceType) {
setDeviceDbSource(sourceType, "");
}
/**
* Enables Device DB store.
* The store uses filesystem to save information obtained from the Device DB.
* The stored data are later used instead of the Device DB.
* @param storeLocation Specifies relative or absolute path of the folder used by the store.
* If left empty defaults to a folder in user home directory.
* Must be accessible by the process.
*/
public static void enableDeviceDbStore(
String storeLocation) {
Main.ToggleDeviceDbStoreRequest.Builder builder = Main.ToggleDeviceDbStoreRequest.newBuilder();
builder = builder.setToggleOn(true);
builder = builder.setStoreLocation(storeLocation);
Call.callSync("device_db/toggle_store", builder.build(), null);
}
/**
* Enables Device DB store.
* The store uses filesystem to save information obtained from the Device DB.
* The stored data are later used instead of the Device DB.
*/
public static void enableDeviceDbStore() {
enableDeviceDbStore("");
}
/**
* Disables Device DB store.
*/
public static void disableDeviceDbStore() {
Main.ToggleDeviceDbStoreRequest.Builder builder = Main.ToggleDeviceDbStoreRequest.newBuilder();
Call.callSync("device_db/toggle_store", builder.build(), null);
}
}