Skip to content

File nebula_hw_interface_base.hpp

File List > include > nebula_hw_interfaces > nebula_hw_interfaces_common > nebula_hw_interface_base.hpp

Go to the documentation of this file

// Copyright 2024 TIER IV, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

#ifndef NEBULA_HW_INTERFACE_BASE_H
#define NEBULA_HW_INTERFACE_BASE_H

#include "nebula_common/nebula_common.hpp"
#include "nebula_common/nebula_status.hpp"

#include <memory>
#include <vector>

namespace nebula::drivers
{
class NebulaHwInterfaceBase
{
protected:
  virtual void receive_sensor_packet_callback([[maybe_unused]] std::vector<uint8_t> & buffer) {}
  //  virtual Status RegisterScanCallback(
  //    std::function<void(std::unique_ptr<std::vector<std::vector<uint8_t>>>)> scan_callback) = 0;

public:
  NebulaHwInterfaceBase(NebulaHwInterfaceBase && c) = delete;
  NebulaHwInterfaceBase & operator=(NebulaHwInterfaceBase && c) = delete;
  NebulaHwInterfaceBase(const NebulaHwInterfaceBase & c) = delete;
  NebulaHwInterfaceBase & operator=(const NebulaHwInterfaceBase & c) = delete;

  NebulaHwInterfaceBase() = default;

  virtual Status sensor_interface_start() = 0;

  virtual Status sensor_interface_stop() = 0;
  // You may want to also implement GpsInterfaceStart() and ReceiveGpsCallback, but that is sensor
  // specific.

  virtual Status set_sensor_configuration(
    std::shared_ptr<SensorConfigurationBase> sensor_configuration) = 0;

  virtual Status get_sensor_configuration(SensorConfigurationBase & sensor_configuration) = 0;

  virtual Status get_calibration_configuration(
    [[maybe_unused]] CalibrationConfigurationBase & calibration_configuration)
  {
    return Status::NOT_IMPLEMENTED;
  }
};

}  // namespace nebula::drivers

#endif  // NEBULA_HW_INTERFACE_BASE_H