#pragma once

#include <pcl/point_types.h>
#include <pcl/point_cloud.h>

#include "pahoc/mqtt_async.h"
#include "tool/log.hpp"
#include "vzense/device_tof3d.h"
#include "net_message_trans.h"

#include "detect/data_buf_lable.hpp"

class Tof3DMqttAsyncClient : public MqttAsyncClient {
    friend class MqttAsyncClient;
public:
    static Tof3DMqttAsyncClient *iter() {
        static Tof3DMqttAsyncClient *instance = nullptr;
        if (instance == nullptr) {
            instance = new Tof3DMqttAsyncClient();
        }
        return instance;
    }

    void init(const std::string &file);

protected:

private:
    Tof3DMqttAsyncClient() = default;

    void run();

    static int CloudDataArrived(void *client, char *topicName, int topicLen, MQTTAsync_message *message);

public:

private:

    std::thread *t = nullptr;
    Thread_condition *condit = nullptr;
};
