#include <softbus_edge/egress/UplinkClient.h>

namespace softbus::edge {

UplinkClient::UplinkClient(std::string host, uint16_t port)
    : client_(std::make_unique<softbus::transport::TcpUplinkClient>(std::move(host), port))
{
}

UplinkClient::~UplinkClient()
{
    disconnect();
}

bool UplinkClient::connect()
{
    return client_->connect();
}

void UplinkClient::disconnect()
{
    client_->disconnect();
}

bool UplinkClient::sendRawPacket(const softbus::core::RawPacket& packet)
{
    return client_->sendRawPacket(packet);
}

bool UplinkClient::sendAck(const softbus::core::SoftbusAck& ack)
{
    return client_->sendAck(ack);
}

bool UplinkClient::sendHeartbeat(const std::string& deviceId)
{
    return client_->sendHeartbeat(deviceId);
}

void UplinkClient::setCommandHandler(std::function<void(const softbus::api::ExecuteCommand&)> handler)
{
    client_->setCommandHandler(std::move(handler));
}

void UplinkClient::poll()
{
    client_->poll();
}

} // namespace softbus::edge
