#pragma once
/***********************************************************
 Copyright (c) 2019-2020 Qualcomm Technologies, Inc.
 All Rights Reserved.
 Confidential and Proprietary - Qualcomm Technologies, Inc.
************************************************************/

/**
 * Interface to the SMCInvoke Example App functionality.
 */

/** @cond */

// AUTOGENERATED FILE: DO NOT EDIT

#include <cstdint>
#include "object.h"
#include "proxy_base.hpp"
#include "ICallbackObjectExample.hpp"

class IISMCIExampleApp {
   public:
    static const uint32_t HASH_SHA256_SIZE = UINT32_C(32);
    static const uint32_t HASH_SHA256 = UINT32_C(1);

    static const int32_t ERROR_INPUT_BUFFER_TOO_SMALL = INT32_C(10);

    virtual ~IISMCIExampleApp() {}

    virtual int32_t serviceExample() = 0;
    virtual int32_t computeHash(const void* input_ptr, size_t input_len, uint32_t algorithm_val, void* hash_ptr, size_t hash_len, size_t* hash_lenout) = 0;
    virtual int32_t sharedMemoryExample(const ProxyBase &memObj_ref) = 0;
    virtual int32_t callbackObjectExample(const ICallbackObjectExample &callbackObj_ref) = 0;

   protected:
    static const ObjectOp OP_serviceExample = 0;
    static const ObjectOp OP_computeHash = 1;
    static const ObjectOp OP_sharedMemoryExample = 2;
    static const ObjectOp OP_callbackObjectExample = 3;
};

class ISMCIExampleApp : public IISMCIExampleApp, public ProxyBase {
   public:
    ISMCIExampleApp() {}
    ISMCIExampleApp(Object impl) : ProxyBase(impl) {}
    virtual ~ISMCIExampleApp() {}

    virtual int32_t serviceExample() {
        return invoke(OP_serviceExample, 0, 0);
    }

    virtual int32_t computeHash(const void* input_ptr, size_t input_len, uint32_t algorithm_val, void* hash_ptr, size_t hash_len, size_t* hash_lenout) {
        ObjectArg a[3]={{{0,0}}};
        a[0].bi = (ObjectBufIn) {input_ptr, input_len * 1};
        a[1].b = (ObjectBuf) {&algorithm_val, sizeof(uint32_t)};
        a[2].b = (ObjectBuf) {hash_ptr, hash_len * 1};

        int32_t result = invoke(OP_computeHash, a, ObjectCounts_pack(2, 1, 0, 0));
        if (Object_OK != result) { return result; }

        *hash_lenout = a[2].b.size / 1;

        return result;
    }

    virtual int32_t sharedMemoryExample(const ProxyBase &memObj_ref) {
        ObjectArg a[1]={{{0,0}}};
        a[0].o = memObj_ref.get();

        return invoke(OP_sharedMemoryExample, a, ObjectCounts_pack(0, 0, 1, 0));
    }

    virtual int32_t callbackObjectExample(const ICallbackObjectExample &callbackObj_ref) {
        ObjectArg a[1]={{{0,0}}};
        a[0].o = callbackObj_ref.get();

        return invoke(OP_callbackObjectExample, a, ObjectCounts_pack(0, 0, 1, 0));
    }

};

