embedded-framework/utils/McuProtocol/src/LittleEndianHandle.h
2024-02-08 14:18:42 -08:00

31 lines
1.2 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 LITTLE_ENDIAN_HANDLE_H
#define LITTLE_ENDIAN_HANDLE_H
#include "ProtocolHandle.h"
class LittleEndianHandle : public ProtocolHandle
{
public:
LittleEndianHandle(const std::shared_ptr<VProtocolParam> &param);
LittleEndianHandle(const void *data, const size_t &length);
virtual ~LittleEndianHandle() = default;
private:
void BigEndianConversion(ProtocolPacket &packet) override;
short BigEndianConversion(const short &number) override;
void HostByteOrderConversion(ProtocolPacket &packet) override;
bool CheckoutTheCheckCode(const ProtocolPacket &packet) override;
};
#endif