lds_lvx.h
Go to the documentation of this file.
1 //
2 // The MIT License (MIT)
3 //
4 // Copyright (c) 2019 Livox. All rights reserved.
5 //
6 // Permission is hereby granted, free of charge, to any person obtaining a copy
7 // of this software and associated documentation files (the "Software"), to deal
8 // in the Software without restriction, including without limitation the rights
9 // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 // copies of the Software, and to permit persons to whom the Software is
11 // furnished to do so, subject to the following conditions:
12 //
13 // The above copyright notice and this permission notice shall be included in
14 // all copies or substantial portions of the Software.
15 //
16 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 // SOFTWARE.
23 //
24 
25 // livox lidar lvx data source
26 
27 #ifndef LIVOX_ROS_DRIVER_LDS_LVX_H_
28 #define LIVOX_ROS_DRIVER_LDS_LVX_H_
29 
30 #include <memory>
31 #include <thread>
32 
33 #include "lds.h"
34 #include "lvx_file.h"
35 
36 namespace livox_ros {
37 
41 class LdsLvx : public Lds {
42  public:
43  static LdsLvx *GetInstance(uint32_t interval_ms) {
44  static LdsLvx lds_lvx(interval_ms);
45  return &lds_lvx;
46  }
47 
48  int InitLdsLvx(const char *lvx_path);
49  int DeInitLdsLvx(void);
50  void PrepareExit(void);
51 
52  private:
53  LdsLvx(uint32_t interval_ms);
54  LdsLvx(const LdsLvx &) = delete;
55  ~LdsLvx();
56  LdsLvx &operator=(const LdsLvx &) = delete;
57 
58  void StartRead() { start_read_lvx_ = true; }
59  void StopRead() { start_read_lvx_ = false; }
60  bool IsStarted() { return start_read_lvx_; }
61 
62  void ReadLvxFile();
63 
64  volatile bool is_initialized_;
66  std::shared_ptr<LvxFileHandle> lvx_file_;
67  std::shared_ptr<std::thread> t_read_lvx_;
68  volatile bool start_read_lvx_;
69 };
70 
71 } // namespace livox_ros
72 #endif
std::shared_ptr< std::thread > t_read_lvx_
Definition: lds_lvx.h:67
volatile bool is_initialized_
Definition: lds_lvx.h:64
static LdsLvx * GetInstance(uint32_t interval_ms)
Definition: lds_lvx.h:43
LdsLvx & operator=(const LdsLvx &)=delete
void StartRead()
Definition: lds_lvx.h:58
volatile bool start_read_lvx_
Definition: lds_lvx.h:68
void StopRead()
Definition: lds_lvx.h:59
std::shared_ptr< LvxFileHandle > lvx_file_
Definition: lds_lvx.h:66
unsigned int uint32_t
Definition: stdint.h:127
LdsLvx(uint32_t interval_ms)
Definition: lds_lvx.cpp:42
int DeInitLdsLvx(void)
int InitLdsLvx(const char *lvx_path)
Definition: lds_lvx.cpp:66
OutPacketBuffer packets_of_frame_
Definition: lds_lvx.h:65
void ReadLvxFile()
Definition: lds_lvx.cpp:135
bool IsStarted()
Definition: lds_lvx.h:60
void PrepareExit(void)
Definition: lds_lvx.cpp:61


livox_ros_driver
Author(s): Livox Dev Team
autogenerated on Mon Mar 15 2021 02:40:46