summaryrefslogtreecommitdiff
path: root/src/test/commonapi/tests/TestInterfaceStubDefault.h
blob: bc5cdffcf3c912b0f51f6969ff27120f58f1ad58 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef COMMONAPI_TESTS_TEST_INTERFACE_STUB_DEFAULT_H_
#define COMMONAPI_TESTS_TEST_INTERFACE_STUB_DEFAULT_H_

#include "TestInterfaceStub.h"

namespace commonapi {
namespace tests {

class TestInterfaceStubDefault : public TestInterfaceStub {
 public:
    TestInterfaceStubDefault();

    TestInterfaceStubRemoteEvent* initStubAdapter(const std::shared_ptr<TestInterfaceStubAdapter>& stubAdapter);
    void deinitStubAdapter();

    virtual const uint32_t& getTestPredefinedTypeAttributeAttribute();
    virtual void setTestPredefinedTypeAttributeAttribute(uint32_t value);

    virtual const DerivedTypeCollection::TestStructExtended& getTestDerivedStructAttributeAttribute();
    virtual void setTestDerivedStructAttributeAttribute(DerivedTypeCollection::TestStructExtended value);

    virtual const DerivedTypeCollection::TestArrayUInt64& getTestDerivedArrayAttributeAttribute();
    virtual void setTestDerivedArrayAttributeAttribute(DerivedTypeCollection::TestArrayUInt64 value);


    virtual void testVoidPredefinedTypeMethod(uint32_t uint32Value, std::string stringValue);

    virtual void testPredefinedTypeMethod(uint32_t uint32InValue, std::string stringInValue, uint32_t& uint32OutValue, std::string& stringOutValue);

    virtual void testVoidDerivedTypeMethod(DerivedTypeCollection::TestEnumExtended2 testEnumExtended2Value, DerivedTypeCollection::TestMap testMapValue);

    virtual void testDerivedTypeMethod(DerivedTypeCollection::TestEnumExtended2 testEnumExtended2InValue, DerivedTypeCollection::TestMap testMapInValue, DerivedTypeCollection::TestEnumExtended2& testEnumExtended2OutValue, DerivedTypeCollection::TestMap& testMapOutValue);

    
    virtual void fireTestPredefinedTypeBroadcastEvent(const uint32_t& uint32Value, const std::string& stringValue);

 protected:
    virtual void onRemoteTestPredefinedTypeAttributeAttributeChanged();
    virtual bool trySetTestPredefinedTypeAttributeAttribute(uint32_t value);
    virtual bool validateTestPredefinedTypeAttributeAttributeRequestedValue(const uint32_t& value);

    virtual void onRemoteTestDerivedStructAttributeAttributeChanged();
    virtual bool trySetTestDerivedStructAttributeAttribute(DerivedTypeCollection::TestStructExtended value);
    virtual bool validateTestDerivedStructAttributeAttributeRequestedValue(const DerivedTypeCollection::TestStructExtended& value);

    virtual void onRemoteTestDerivedArrayAttributeAttributeChanged();
    virtual bool trySetTestDerivedArrayAttributeAttribute(DerivedTypeCollection::TestArrayUInt64 value);
    virtual bool validateTestDerivedArrayAttributeAttributeRequestedValue(const DerivedTypeCollection::TestArrayUInt64& value);

    
 private:
    class RemoteEventHandler: public TestInterfaceStubRemoteEvent {
     public:
        RemoteEventHandler(TestInterfaceStubDefault* defaultStub);

        virtual bool onRemoteSetTestPredefinedTypeAttributeAttribute(uint32_t value);
        virtual void onRemoteTestPredefinedTypeAttributeAttributeChanged();

        virtual bool onRemoteSetTestDerivedStructAttributeAttribute(DerivedTypeCollection::TestStructExtended value);
        virtual void onRemoteTestDerivedStructAttributeAttributeChanged();

        virtual bool onRemoteSetTestDerivedArrayAttributeAttribute(DerivedTypeCollection::TestArrayUInt64 value);
        virtual void onRemoteTestDerivedArrayAttributeAttributeChanged();


     private:
        TestInterfaceStubDefault* defaultStub_;
    };

    RemoteEventHandler remoteEventHandler_;
    std::shared_ptr<TestInterfaceStubAdapter> stubAdapter_;

    uint32_t testPredefinedTypeAttributeAttributeValue_;
    DerivedTypeCollection::TestStructExtended testDerivedStructAttributeAttributeValue_;
    DerivedTypeCollection::TestArrayUInt64 testDerivedArrayAttributeAttributeValue_;
};

} // namespace tests
} // namespace commonapi

#endif // COMMONAPI_TESTS_TEST_INTERFACE_STUB_DEFAULT_H_