@@ -23,6 +23,7 @@ import { EuropeanController } from '../controllers/european.controller';
2323import { celciusToTempCode , tempCodeToCelsius } from '../util' ;
2424import { manageBluelinkyError , ManagedBluelinkyError } from '../tools/common.tools' ;
2525import { addMinutes , parse as parseDate } from 'date-fns' ;
26+ import { EUPOIInformation } from '../interfaces/european.interfaces' ;
2627
2728type ChargeTarget = 50 | 60 | 70 | 80 | 90 | 100 ;
2829const POSSIBLE_CHARGE_LIMIT_VALUES = [ 50 , 60 , 70 , 80 , 90 , 100 ] ;
@@ -637,6 +638,35 @@ export default class EuropeanVehicle extends Vehicle {
637638 throw manageBluelinkyError ( err , 'EuropeVehicle.setChargeTargets' ) ;
638639 }
639640 }
641+
642+ /**
643+ * Define a navigation route
644+ * @param poiInformations The list of POIs and waypoint to go through
645+ */
646+ public async setNavigation ( poiInformations : EUPOIInformation [ ] ) : Promise < void > {
647+ await this . checkControlToken ( ) ;
648+ try {
649+ await got (
650+ `${ this . controller . environment . baseUrl } /api/v2/spa/vehicles/${ this . vehicleConfig . id } /location/routes` ,
651+ {
652+ method : 'POST' ,
653+ headers : {
654+ 'Authorization' : this . controller . session . controlToken ,
655+ 'ccsp-device-id' : this . controller . session . deviceId ,
656+ 'Content-Type' : 'application/json' ,
657+ 'Stamp' : this . controller . environment . stamp ( ) ,
658+ } ,
659+ body : {
660+ deviceID : this . controller . session . deviceId ,
661+ poiInfoList : poiInformations ,
662+ } ,
663+ json : true ,
664+ }
665+ ) ;
666+ } catch ( err ) {
667+ throw manageBluelinkyError ( err , 'EuropeVehicle.setNavigation' ) ;
668+ }
669+ }
640670}
641671
642672function toMonthDate ( month : { year : number ; month : number ; } ) {
0 commit comments