Skip to content
Permalink
Browse files

Mvusb mood fire and forget

  • Loading branch information...
brikendr committed May 14, 2019
1 parent 526e344 commit 43cf683896cbe1ec15d7c2cb4a578aaf13088277
Showing with 6 additions and 13 deletions.
  1. +1 −6 src/components/device/boxfish.ts
  2. +5 −7 tests/components/device/boxfish.spec.ts
@@ -136,12 +136,7 @@ export default class Boxfish extends UvcBaseDevice implements IDeviceManager {
await this.locksmith.executeAsyncFunction(async () => {
await this.transport.clear();
if (mode === 'mvusb') {
await this.api.sendAndReceiveWithoutLock('upgrader/mv_usb', { args: {} });
/**
* Do not await reboot as next time the device boots it will
* be a movidius device instead of a Huddly IQ device.
*/
this.transport.write('camctrl/reboot');
this.transport.write('upgrader/mv_usb', Api.encode({}));
} else {
await this.transport.write('camctrl/reboot');
}
@@ -10,6 +10,7 @@ import Boxfish from './../../../src/components/device/boxfish';
import DefaultLogger from './../../../src/utilitis/logger';
import { EventEmitter } from 'events';
import CameraEvents from './../../../src/utilitis/events';
import Api from './../../../src/components/api';

chai.should();
chai.use(sinonChai);
@@ -121,23 +122,20 @@ describe('Boxfish', () => {

describe('#reboot', () => {
describe('on mvusb mode', () => {
it('should send upgrader/mv_usb msg and not await for reboot msg', async () => {
it('should send upgrader/mv_usb', async () => {
await device.initialize();
sinon.stub(device.api, 'sendAndReceiveWithoutLock').resolves();
await device.reboot('mvusb');
expect(device.transport.clear).to.have.been.calledOnce;
expect(device.api.sendAndReceiveWithoutLock).to.have.been.calledOnce;
expect(device.api.sendAndReceiveWithoutLock).to.have.been.calledWith('upgrader/mv_usb', { args: {}});
expect(device.transport.write).to.have.been.calledWith('camctrl/reboot');
expect(device.transport.write).to.have.been.calledOnce;
expect(device.transport.write).to.have.been.calledWith('upgrader/mv_usb', Api.encode({}));
});
});
describe('on other modes', () => {
it('should only send reboot command', async () => {
await device.initialize();
sinon.stub(device.api, 'sendAndReceiveWithoutLock').resolves();
await device.reboot();
expect(device.transport.clear).to.have.been.calledOnce;
expect(device.api.sendAndReceiveWithoutLock).to.not.have.been.called;
expect(device.transport.write).to.have.been.calledOnce;
expect(device.transport.write).to.have.been.calledWith('camctrl/reboot');
});
});

0 comments on commit 43cf683

Please sign in to comment.
You can’t perform that action at this time.