@@ -13,7 +13,7 @@ import { CoreServiceImpl } from './core-service-impl';
13
13
import { CoreService , CoreServicePath } from '../common/protocol/core-service' ;
14
14
import { ConnectionContainerModule } from '@theia/core/lib/node/messaging/connection-container-module' ;
15
15
import { CoreClientProvider } from './core-client-provider' ;
16
- import { ConnectionHandler , JsonRpcConnectionHandler , JsonRpcProxy } from '@theia/core' ;
16
+ import { ConnectionHandler , JsonRpcConnectionHandler } from '@theia/core' ;
17
17
import { DefaultWorkspaceServer } from './theia/workspace/default-workspace-server' ;
18
18
import { WorkspaceServer as TheiaWorkspaceServer } from '@theia/workspace/lib/common' ;
19
19
import { SketchesServiceImpl } from './sketches-service-impl' ;
@@ -39,6 +39,7 @@ import { OutputServicePath, OutputService } from '../common/protocol/output-serv
39
39
import { NotificationServiceServerImpl } from './notification-service-server' ;
40
40
import { NotificationServiceServer , NotificationServiceClient , NotificationServicePath } from '../common/protocol' ;
41
41
import { BackendApplication } from './theia/core/backend-application' ;
42
+ import { BoardDiscovery } from './board-discovery' ;
42
43
43
44
export default new ContainerModule ( ( bind , unbind , isBound , rebind ) => {
44
45
bind ( BackendApplication ) . toSelf ( ) . inSingletonScope ( ) ;
@@ -60,9 +61,6 @@ export default new ContainerModule((bind, unbind, isBound, rebind) => {
60
61
61
62
// Examples service. One per backend, each connected FE gets a proxy.
62
63
bind ( ConnectionContainerModule ) . toConstantValue ( ConnectionContainerModule . create ( ( { bind, bindBackendService } ) => {
63
- // const ExamplesServiceProxy = Symbol('ExamplesServiceProxy');
64
- // bind(ExamplesServiceProxy).toDynamicValue(ctx => new Proxy(ctx.container.get(ExamplesService), {}));
65
- // bindBackendService(ExamplesServicePath, ExamplesServiceProxy);
66
64
bind ( ExamplesServiceImpl ) . toSelf ( ) . inSingletonScope ( ) ;
67
65
bind ( ExamplesService ) . toService ( ExamplesServiceImpl ) ;
68
66
bindBackendService ( ExamplesServicePath , ExamplesService ) ;
@@ -75,9 +73,6 @@ export default new ContainerModule((bind, unbind, isBound, rebind) => {
75
73
76
74
// Library service. Singleton per backend, each connected FE gets its proxy.
77
75
bind ( ConnectionContainerModule ) . toConstantValue ( ConnectionContainerModule . create ( ( { bind, bindBackendService } ) => {
78
- // const LibraryServiceProxy = Symbol('LibraryServiceProxy');
79
- // bind(LibraryServiceProxy).toDynamicValue(ctx => new Proxy(ctx.container.get(LibraryService), {}));
80
- // bindBackendService(LibraryServicePath, LibraryServiceProxy);
81
76
bind ( LibraryServiceImpl ) . toSelf ( ) . inSingletonScope ( ) ;
82
77
bind ( LibraryService ) . toService ( LibraryServiceImpl ) ;
83
78
bindBackendService ( LibraryServicePath , LibraryService ) ;
@@ -88,27 +83,21 @@ export default new ContainerModule((bind, unbind, isBound, rebind) => {
88
83
bind ( SketchesService ) . toService ( SketchesServiceImpl ) ;
89
84
bind ( ConnectionHandler ) . toDynamicValue ( context => new JsonRpcConnectionHandler ( SketchesServicePath , ( ) => context . container . get ( SketchesService ) ) ) . inSingletonScope ( ) ;
90
85
91
- // Boards service. One singleton per backend that does the board and port polling. Each connected FE gets its proxy .
86
+ // Boards service. One instance per connected frontend .
92
87
bind ( ConnectionContainerModule ) . toConstantValue ( ConnectionContainerModule . create ( ( { bind, bindBackendService } ) => {
93
- // const BoardsServiceProxy = Symbol('BoardsServiceProxy');
94
- // bind(BoardsServiceProxy).toDynamicValue(ctx => new Proxy(ctx.container.get(BoardsService), {}));
95
- // bindBackendService(BoardsServicePath, BoardsServiceProxy);
96
88
bind ( BoardsServiceImpl ) . toSelf ( ) . inSingletonScope ( ) ;
97
89
bind ( BoardsService ) . toService ( BoardsServiceImpl ) ;
98
- bindBackendService < BoardsServiceImpl , JsonRpcProxy < object > > ( BoardsServicePath , BoardsService , ( service , client ) => {
99
- client . onDidCloseConnection ( ( ) => service . dispose ( ) ) ;
100
- return service ;
101
- } ) ;
90
+ bindBackendService ( BoardsServicePath , BoardsService ) ;
102
91
} ) ) ;
103
92
104
93
// Shared Arduino core client provider service for the backend.
105
94
bind ( CoreClientProvider ) . toSelf ( ) . inSingletonScope ( ) ;
106
95
96
+ // Shared port/board discovery for the server
97
+ bind ( BoardDiscovery ) . toSelf ( ) . inSingletonScope ( ) ;
98
+
107
99
// Core service -> `verify` and `upload`. Singleton per BE, each FE connection gets its proxy.
108
100
bind ( ConnectionContainerModule ) . toConstantValue ( ConnectionContainerModule . create ( ( { bind, bindBackendService } ) => {
109
- // const CoreServiceProxy = Symbol('CoreServiceProxy');
110
- // bind(CoreServiceProxy).toDynamicValue(ctx => new Proxy(ctx.container.get(CoreService), {}));
111
- // bindBackendService(CoreServicePath, CoreServiceProxy);
112
101
bind ( CoreServiceImpl ) . toSelf ( ) . inSingletonScope ( ) ;
113
102
bind ( CoreService ) . toService ( CoreServiceImpl ) ;
114
103
bindBackendService ( CoreServicePath , CoreService ) ;
@@ -127,14 +116,12 @@ export default new ContainerModule((bind, unbind, isBound, rebind) => {
127
116
128
117
// #endregion Theia customizations
129
118
130
- // Shared monitor client provider service for the backend.
131
- bind ( MonitorClientProvider ) . toSelf ( ) . inSingletonScope ( ) ;
132
- bind ( MonitorServiceImpl ) . toSelf ( ) . inSingletonScope ( ) ;
133
- bind ( MonitorService ) . toService ( MonitorServiceImpl ) ;
119
+ // Monitor client provider per connected frontend.
134
120
bind ( ConnectionContainerModule ) . toConstantValue ( ConnectionContainerModule . create ( ( { bind, bindBackendService } ) => {
135
- const MonitorServiceProxy = Symbol ( 'MonitorServiceProxy' ) ;
136
- bind ( MonitorServiceProxy ) . toDynamicValue ( ctx => new Proxy ( ctx . container . get ( MonitorService ) , { } ) ) ;
137
- bindBackendService < MonitorService , MonitorServiceClient > ( MonitorServicePath , MonitorServiceProxy , ( service , client ) => {
121
+ bind ( MonitorClientProvider ) . toSelf ( ) . inSingletonScope ( ) ;
122
+ bind ( MonitorServiceImpl ) . toSelf ( ) . inSingletonScope ( ) ;
123
+ bind ( MonitorService ) . toService ( MonitorServiceImpl ) ;
124
+ bindBackendService < MonitorService , MonitorServiceClient > ( MonitorServicePath , MonitorService , ( service , client ) => {
138
125
service . setClient ( client ) ;
139
126
client . onDidCloseConnection ( ( ) => service . dispose ( ) ) ;
140
127
return service ;
0 commit comments