theta-ble-client-react-native
Version:
This library provides a way to control RICOH THETA using
146 lines (137 loc) • 4.55 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.ShootingControlCommand = void 0;
var _thetaService = require("./theta-service");
var _values = require("./values");
var ThetaBleClient = _interopRequireWildcard(require("../native"));
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
/* eslint no-useless-catch: 0 */
/**
* Shooting Control Command Service
*
* Service: 1D0F3602-8DFB-4340-9045-513040DAD991
*/
class ShootingControlCommand extends _thetaService.ThetaService {
constructor(device) {
super();
this.service = _values.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);
});
}
}
exports.ShootingControlCommand = ShootingControlCommand;
//# sourceMappingURL=shooting-control-command.js.map