1 // 2 // Copyright © 2019 Arm Ltd and Contributors. All rights reserved. 3 // SPDX-License-Identifier: MIT 4 // 5 6 #pragma once 7 8 #include <common/include/CommandHandlerFunctor.hpp> 9 #include <common/include/Packet.hpp> 10 11 #include <vector> 12 13 namespace armnn 14 { 15 16 namespace gatordmock 17 { 18 19 struct PacketVersion 20 { 21 uint16_t m_PacketFamily; 22 uint16_t m_PacketId; 23 uint32_t m_PacketVersion; 24 }; 25 26 class StreamMetadataCommandHandler : public arm::pipe::CommandHandlerFunctor 27 { 28 29 public: 30 /** 31 * @param familyId The family of the packets this handler will service 32 * @param packetId The id of packets this handler will process 33 * @param version The version of that id 34 * @param quietOperation Optional parameter to turn off printouts. This is useful for unit tests 35 */ StreamMetadataCommandHandler(uint32_t familyId,uint32_t packetId,uint32_t version,bool quietOperation=false)36 StreamMetadataCommandHandler(uint32_t familyId, 37 uint32_t packetId, 38 uint32_t version, 39 bool quietOperation = false) 40 : CommandHandlerFunctor(familyId, packetId, version) 41 , m_QuietOperation(quietOperation) 42 {} 43 44 void operator()(const arm::pipe::Packet& packet) override; 45 46 private: 47 void ParseData(const arm::pipe::Packet& packet); 48 49 uint32_t m_PipeMagic; 50 uint32_t m_StreamMetadataVersion; 51 uint32_t m_MaxDataLen; 52 uint32_t m_Pid; 53 uint32_t m_OffsetInfo; 54 uint32_t m_OffsetHwVersion; 55 uint32_t m_OffsetSwVersion; 56 uint32_t m_OffsetProcessName; 57 uint32_t m_OffsetPacketVersionTable; 58 59 std::string m_SoftwareInfo; 60 std::string m_HardwareVersion; 61 std::string m_SoftwareVersion; 62 std::string m_ProcessName; 63 64 std::vector<PacketVersion> m_PacketVersionTable; 65 66 bool m_QuietOperation; 67 }; 68 69 } // namespace gatordmock 70 71 } // namespace armnn 72