theta-ble-client-react-native
Version:
This library provides a way to control RICOH THETA using
139 lines (130 loc) • 3.73 kB
JavaScript
/* eslint no-useless-catch: 0 */
import { ThetaService } from './theta-service';
import { BleServiceEnum } from './values';
import * as ThetaBleClient from '../native';
/**
* Shooting Control Command Service
*
* Service: 1D0F3602-8DFB-4340-9045-513040DAD991
*/
export class ShootingControlCommand extends ThetaService {
constructor(device) {
super();
this.service = BleServiceEnum.SHOOTING_CONTROL_COMMAND;
this.device = device;
}
/**
* Acquires the capture mode of the camera.
*
* Service: 1D0F3602-8DFB-4340-9045-513040DAD991
*
* Characteristic: 78009238-AC3D-4370-9B6F-C9CE2F4E3CA8
*
* @returns Capture Mode.
*/
async getCaptureMode() {
return new Promise((resolve, reject) => {
ThetaBleClient.nativeGetCaptureMode(this.device.id).then(value => {
resolve(value);
}).catch(error => reject(error));
});
}
/**
* Set the capture mode of the camera.
*
* Service: 1D0F3602-8DFB-4340-9045-513040DAD991
*
* Characteristic: 78009238-AC3D-4370-9B6F-C9CE2F4E3CA8
*
* @param mode Capture Mode.
*/
async setCaptureMode(mode) {
try {
return await ThetaBleClient.nativeSetCaptureMode(this.device.id, mode);
} catch (error) {
throw error;
}
}
/**
* Acquires the recording size (pixels) of the camera.
*
* Service: 1D0F3602-8DFB-4340-9045-513040DAD991
*
* Characteristic: E8F0EDD1-6C0F-494A-95C3-3244AE0B9A01
*
* @returns File format.
*/
async getFileFormat() {
return new Promise((resolve, reject) => {
ThetaBleClient.nativeGetFileFormat(this.device.id).then(value => {
resolve(value);
}).catch(error => reject(error));
});
}
/**
* Set the recording size (pixels) of the camera.
*
* Service: 1D0F3602-8DFB-4340-9045-513040DAD991
*
* Characteristic: E8F0EDD1-6C0F-494A-95C3-3244AE0B9A01
*
* @param value File format.
*/
async setFileFormat(value) {
try {
return await ThetaBleClient.nativeSetFileFormat(this.device.id, value);
} catch (error) {
throw error;
}
}
/**
* Acquires the maximum recordable time (in seconds) of the camera.
*
* Service: 1D0F3602-8DFB-4340-9045-513040DAD991
*
* Characteristic: 6EABAB73-7F2B-4061-BE7C-1D71D143CB7D
*
* @returns Maximum recordable time.
*/
async getMaxRecordableTime() {
return new Promise((resolve, reject) => {
ThetaBleClient.nativeGetMaxRecordableTime(this.device.id).then(value => {
resolve(value);
}).catch(error => reject(error));
});
}
/**
* Set the maximum recordable time (in seconds) of the camera.
*
* Service: 1D0F3602-8DFB-4340-9045-513040DAD991
*
* Characteristic: 6EABAB73-7F2B-4061-BE7C-1D71D143CB7D
*
* @param value Maximum recordable time.
*/
async setMaxRecordableTime(value) {
try {
return await ThetaBleClient.nativeSetMaxRecordableTime(this.device.id, value);
} catch (error) {
throw error;
}
}
/**
* Instructs the camera to start shooting a still image. Also, acquires the shooting status.
*
* Service: 1D0F3602-8DFB-4340-9045-513040DAD991
*
* Characteristic: FEC1805C-8905-4477-B862-BA5E447528A5
*
* @param complete Notification of end of shooting. If an error occurs, notify the argument.
*/
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
takePicture(complete) {
ThetaBleClient.nativeTakePicture(this.device.id).then(() => {
complete === null || complete === void 0 || complete();
}).catch(error => {
complete === null || complete === void 0 || complete(error);
});
}
}
//# sourceMappingURL=shooting-control-command.js.map