@@ -88,11 +88,11 @@ class DeviceRepository {
88
88
throw new HttpError ( 'No device found' , 404 ) ;
89
89
}
90
90
91
- const core = this . _deviceServer . getCore ( attributes . deviceID ) ;
91
+ const device = this . _deviceServer . getDevice ( attributes . deviceID ) ;
92
92
// TODO: Not sure if this should actually be the core ID that gets sent
93
93
// but that's what the old source code does :/
94
- const response = core
95
- ? await core . onApiMessage (
94
+ const response = device
95
+ ? await device . onApiMessage (
96
96
attributes . deviceID ,
97
97
{ cmd : 'Ping' } ,
98
98
)
@@ -110,14 +110,14 @@ class DeviceRepository {
110
110
} ;
111
111
112
112
getDetailsByID = async ( deviceID : string , userID : string ) : Promise < Device > => {
113
- const core = this . _deviceServer . getCore ( deviceID ) ;
114
- if ( ! core ) {
113
+ const device = this . _deviceServer . getDevice ( deviceID ) ;
114
+ if ( ! device ) {
115
115
throw new HttpError ( 'No device found' , 404 ) ;
116
116
}
117
117
118
118
const [ attributes , description ] = await Promise . all ( [
119
119
this . _deviceAttributeRepository . getById ( deviceID , userID ) ,
120
- core . onApiMessage (
120
+ device . onApiMessage (
121
121
deviceID ,
122
122
{ cmd : 'Describe' } ,
123
123
) ,
@@ -141,11 +141,11 @@ class DeviceRepository {
141
141
const devicesAttributes =
142
142
await this . _deviceAttributeRepository . getAll ( userID ) ;
143
143
const devicePromises = devicesAttributes . map ( async attributes => {
144
- const core = this . _deviceServer . getCore ( attributes . deviceID ) ;
144
+ const device = this . _deviceServer . getDevice ( attributes . deviceID ) ;
145
145
// TODO: Not sure if this should actually be the core ID that gets sent
146
146
// but that's what the old source code does :/
147
- const response = core
148
- ? await core . onApiMessage (
147
+ const response = device
148
+ ? await device . onApiMessage (
149
149
attributes . deviceID ,
150
150
{ cmd : 'Ping' } ,
151
151
)
@@ -175,11 +175,11 @@ class DeviceRepository {
175
175
throw new HttpError ( 'No device found' , 404 ) ;
176
176
}
177
177
178
- const core = this . _deviceServer . getCore ( deviceID ) ;
179
- if ( ! core ) {
178
+ const device = this . _deviceServer . getDevice ( deviceID ) ;
179
+ if ( ! device ) {
180
180
throw new HttpError ( 'Could not get device for ID' , 404 ) ;
181
181
}
182
- const result = await core . onApiMessage (
182
+ const result = await device . onApiMessage (
183
183
deviceID ,
184
184
{ cmd : 'CallFn' , name : functionName , args : functionArguments } ,
185
185
) ;
@@ -200,11 +200,11 @@ class DeviceRepository {
200
200
throw new HttpError ( 'No device found' , 404 ) ;
201
201
}
202
202
203
- const core = this . _deviceServer . getCore ( deviceID ) ;
204
- if ( ! core ) {
203
+ const device = this . _deviceServer . getDevice ( deviceID ) ;
204
+ if ( ! device ) {
205
205
throw new HttpError ( 'Could not get device for ID' , 404 ) ;
206
206
}
207
- const result = await core . onApiMessage (
207
+ const result = await device . onApiMessage (
208
208
deviceID ,
209
209
{ cmd : 'GetVar' , name : varName } ,
210
210
) ;
@@ -220,12 +220,12 @@ class DeviceRepository {
220
220
deviceID : string ,
221
221
file : File ,
222
222
) => {
223
- const core = this . _deviceServer . getCore ( deviceID ) ;
224
- if ( ! core ) {
223
+ const device = this . _deviceServer . getDevice ( deviceID ) ;
224
+ if ( ! device ) {
225
225
throw new HttpError ( 'Could not get device for ID' , 404 ) ;
226
226
}
227
227
228
- const result = await core . onApiMessage (
228
+ const result = await device . onApiMessage (
229
229
deviceID ,
230
230
{ cmd : 'UFlash' , args : { data : file . buffer } } ,
231
231
) ;
@@ -252,12 +252,12 @@ class DeviceRepository {
252
252
throw new HttpError ( `No firmware ${ appName } found` ) ;
253
253
}
254
254
255
- const core = this . _deviceServer . getCore ( deviceID ) ;
256
- if ( ! core ) {
255
+ const device = this . _deviceServer . getDevice ( deviceID ) ;
256
+ if ( ! device ) {
257
257
throw new HttpError ( 'Could not get device for ID' , 404 ) ;
258
258
}
259
259
260
- const result = await core . onApiMessage (
260
+ const result = await device . onApiMessage (
261
261
deviceID ,
262
262
{ cmd : 'UFlash' , args : { data : knownFirmware } } ,
263
263
) ;
0 commit comments