// Good to be called by car software/firmware.
Good to be called by car software/firmware.
// Good to be called by car software / firmware .
func (s *Service) UpdateCar(c context.Context, req *carpb.UpdateCarRequest) (*carpb.UpdateCarResponse, error) {
	update := &dao.CarUpdate{
		Status:   req.Status,
		Position: req.Position,
	}
	if req.Status == carpb.CarStatus_LOCKED {
		update.Driver = &carpb.Driver{}
		update.UpdateTripID = true
		update.TripID = id.TripID("")
	}
	car, err := s.Mongo.UpdateCar(c, id.CarID(req.Id), carpb.CarStatus_CS_NOT_SPECIFIED, update)
	if err != nil {
		return nil, status.Error(codes.Internal, err.Error())
	}
	s.publish(c, car)
	return &carpb.UpdateCarResponse{}, nil
}
func ( s * Service ) UpdateCar ( c context . Context , req * carpb . UpdateCarRequest ) ( * carpb . UpdateCarResponse , error ) { update := & dao . CarUpdate { Status : req . Status , Position : req . Position , } if req . Status == carpb . CarStatus_LOCKED { update . Driver = & carpb . Driver { } update . UpdateTripID = true update . TripID = id . TripID ( " " ) } car , err := s . Mongo . UpdateCar ( c , id . CarID ( req . Id ) , carpb . CarStatus_CS_NOT_SPECIFIED , update ) if err != nil { return nil , status . Error ( codes . Internal , err . Error ( ) ) } s . publish ( c , car ) return & carpb . UpdateCarResponse { } , nil }
Good to be called by car software/firmware.
Good to be called by car software / firmware .
//clear