@@ -10,7 +10,7 @@ import { handleDefNumberVector, handleDefSwitchVector, handleDefTextVector, hand
1010import type { Camera , Client , Device , Focuser , Mount , Rotator , Wheel } from './indi.device'
1111import type { DeviceProvider } from './indi.manager'
1212// biome-ignore format: too long!
13- import { type DefBlob , type DefBlobVector , type DefNumber , type DefNumberVector , type DefSwitch , type DefSwitchVector , type DefText , type DefTextVector , type DefVector , type EnableBlob , findOnSwitch , type GetProperties , type NewNumberVector , type NewSwitchVector , type NewTextVector , type OneBlob , type PropertyPermission , type PropertyState , type SetBlobVector , type SwitchRule , type ValueType , type VectorType } from './indi.types'
13+ import { type DefSwitchVector , type DefVector , type EnableBlob , findOnSwitch , type GetProperties , makeBlobVector , makeNumberVector , makeSwitchVector , makeTextVector , type NewNumberVector , type NewSwitchVector , type NewTextVector , type PropertyState , type ValueType , type VectorType } from './indi.types'
1414import { roundToNthDecimal } from './math'
1515import { formatTemporal , TIMEZONE } from './temporal'
1616import { type Time , timeNow } from './time'
@@ -51,7 +51,7 @@ export class AlpacaClient implements Client {
5151 if ( command ?. device ) {
5252 this . devices . get ( command . device ) ?. sendProperties ( command . name )
5353 } else {
54- for ( const [ , device ] of this . devices ) device . sendProperties ( command ?. name )
54+ for ( const device of this . devices ) device [ 1 ] . sendProperties ( command ?. name )
5555 }
5656 }
5757
@@ -111,15 +111,15 @@ export class AlpacaClient implements Client {
111111 }
112112
113113 private update ( ) {
114- for ( const [ , device ] of this . devices ) device . update ( )
114+ for ( const device of this . devices ) device [ 1 ] . update ( )
115115 }
116116
117117 stop ( server : boolean = false ) {
118118 if ( this . timer ) {
119119 clearInterval ( this . timer )
120120 this . timer = undefined
121121
122- for ( const [ , device ] of this . devices ) device . close ( )
122+ for ( const device of this . devices ) device [ 1 ] . close ( )
123123 this . devices . clear ( )
124124
125125 this . options ?. handler ?. close ?.( this , server )
@@ -1797,30 +1797,6 @@ function normalizeLongitude(angle: number) {
17971797 return angle
17981798}
17991799
1800- function makeSwitchVector ( device : string , name : string , label : string , group : string , rule : SwitchRule , permission : PropertyPermission , ...properties : readonly [ string , string , boolean ] [ ] ) : DefSwitchVector & { type : 'SWITCH' } {
1801- const elements : Record < string , DefSwitch > = { }
1802- for ( const [ name , label , value ] of properties ) elements [ name ] = { name, label, value }
1803- return { type : 'SWITCH' , device, name, label, group, permission, rule, state : 'Idle' , timeout : 60 , elements }
1804- }
1805-
1806- function makeNumberVector ( device : string , name : string , label : string , group : string , permission : PropertyPermission , ...properties : readonly [ string , string , number , number , number , number , string ] [ ] ) : DefNumberVector & { type : 'NUMBER' } {
1807- const elements : Record < string , DefNumber > = { }
1808- for ( const [ name , label , value , min , max , step , format ] of properties ) elements [ name ] = { name, label, value, min, max, step, format }
1809- return { type : 'NUMBER' , device, name, label, group, permission, state : 'Idle' , timeout : 60 , elements }
1810- }
1811-
1812- function makeTextVector ( device : string , name : string , label : string , group : string , permission : PropertyPermission , ...properties : readonly [ string , string , string ] [ ] ) : DefTextVector & { type : 'TEXT' } {
1813- const elements : Record < string , DefText > = { }
1814- for ( const [ name , label , value ] of properties ) elements [ name ] = { name, label, value }
1815- return { type : 'TEXT' , device, name, label, group, permission, state : 'Idle' , timeout : 60 , elements }
1816- }
1817-
1818- function makeBlobVector ( device : string , name : string , label : string , group : string , permission : PropertyPermission , ...properties : readonly [ string , string ] [ ] ) : Omit < DefBlobVector , 'elements' > & SetBlobVector & { type : 'BLOB' } {
1819- const elements : Record < string , Omit < DefBlob , 'value' > & OneBlob > = { }
1820- for ( const [ name , label ] of properties ) elements [ name ] = { name, label, size : '0' , format : 'fits' , value : '' }
1821- return { type : 'BLOB' , device, name, label, group, permission, state : 'Idle' , timeout : 60 , elements }
1822- }
1823-
18241800// https://github.com/ASCOMInitiative/ASCOMRemote/blob/main/Documentation/AlpacaImageBytes.pdf
18251801
18261802export function makeFitsFromImageBytes ( data : ArrayBuffer , time ?: Time , camera ?: Camera , mount ?: Mount , wheel ?: Wheel , focuser ?: Focuser , rotator ?: Rotator , lastExposureDuration : number = 0 ) {
0 commit comments