hunting/utils/McuProtocol/include/McuProtocol.h
2024-02-02 06:25:00 -08:00

60 lines
1.6 KiB
C++

/*
* Copyright (c) 2023 Fancy Code.
* 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 MCU_PROTOCOL_H
#define MCU_PROTOCOL_H
#include "StatusCode.h"
#include <cstddef>
#include <memory>
/**
* @brief The context of protocol processing is used for the association binding of protocol data transmission and
* reception, ensuring the correct logic of protocol question and answer.
*
*/
class VProtocolContext
{
public:
VProtocolContext() = default;
virtual ~VProtocolContext() = default;
};
template <typename T>
class ProtocolContext : public VProtocolContext
{
public:
ProtocolContext(T &value) : mData(value) {}
virtual ~ProtocolContext() = default;
public:
T mData;
};
class VProtocolBase
{
public:
VProtocolBase() = default;
virtual ~VProtocolBase() = default;
public:
virtual size_t WriteData(const void *buff, const size_t buffLength) { return 0; }
public:
};
class McuProtocol : virtual public VProtocolBase
{
public:
McuProtocol() = default;
virtual ~McuProtocol() = default;
const StatusCode GetIpcMissiony(std::shared_ptr<VProtocolContext> &context);
};
#endif