Make WindowsDevice for Sonar

Summary:
This diff adds the ability for a windows desktop app to be a selectable device for Sonar.

just to over-communicate what I'm thinking regarding the logging: windows system logs don't have a lot of valuable information in my experience, and there is a ton of garbage, but there is probably a way to tap into that if we want.

however, I was thinking that redirecting stderr/stdout from every connected process would be useful. i.e. OVRServer could register a log plugin and it would write to the device's log output. not sure if this would be better than just having a logger plugin. This is probably a pretty naive question and this probably isn't the place to have this conversation...but here we are :)

Reviewed By: jknoxville

Differential Revision: D8861986

fbshipit-source-id: f6ccba28729692ae4566dd24302268ad54d437eb
This commit is contained in:
Aaron Brady
2018-08-13 11:21:55 -07:00
committed by Facebook Github Bot
parent 1a7ef4fc85
commit b552dc6f52
3 changed files with 57 additions and 3 deletions

View File

@@ -0,0 +1,27 @@
/**
* Copyright 2018-present Facebook.
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
* @format
*/
import type {DeviceLogListener} from './BaseDevice.js';
import BaseDevice from './BaseDevice.js';
export default class WindowsDevice extends BaseDevice {
supportedPlugins = [];
icon = 'icons/oculus.png';
os = 'windows';
constructor() {
super('', 'physical', 'desktop');
}
teardown() {}
supportedColumns(): Array<string> {
return [];
}
addLogListener(_callback: DeviceLogListener) {}
}

View File

@@ -7,6 +7,7 @@
import androidDevice from './androidDevice'; import androidDevice from './androidDevice';
import iOSDevice from './iOSDevice'; import iOSDevice from './iOSDevice';
import windowsDevice from './windowsDevice';
import application from './application'; import application from './application';
import tracking from './tracking'; import tracking from './tracking';
import server from './server'; import server from './server';
@@ -15,6 +16,11 @@ import type Logger from '../fb-stubs/Logger.js';
import type {Store} from '../reducers/index.js'; import type {Store} from '../reducers/index.js';
export default (store: Store, logger: Logger) => export default (store: Store, logger: Logger) =>
[application, androidDevice, iOSDevice, tracking, server].forEach(fn => [
fn(store, logger), application,
); androidDevice,
iOSDevice,
windowsDevice,
tracking,
server,
].forEach(fn => fn(store, logger));

View File

@@ -0,0 +1,21 @@
/**
* Copyright 2018-present Facebook.
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
* @format
*/
import type {Store} from '../reducers/index.js';
import type Logger from '../fb-stubs/Logger.js';
import WindowsDevice from '../devices/WindowsDevice';
export default (store: Store, logger: Logger) => {
if (process.platform !== 'win32') {
return;
}
store.dispatch({
type: 'REGISTER_DEVICE',
payload: new WindowsDevice(),
});
};