Fix for x86_64 build fail
[platform/upstream/connectedhomeip.git] / examples / all-clusters-app / linux / main.cpp
1 /*
2  *
3  *    Copyright (c) 2020 Project CHIP Authors
4  *    All rights reserved.
5  *
6  *    Licensed under the Apache License, Version 2.0 (the "License");
7  *    you may not use this file except in compliance with the License.
8  *    You may obtain a copy of the License at
9  *
10  *        http://www.apache.org/licenses/LICENSE-2.0
11  *
12  *    Unless required by applicable law or agreed to in writing, software
13  *    distributed under the License is distributed on an "AS IS" BASIS,
14  *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  *    See the License for the specific language governing permissions and
16  *    limitations under the License.
17  */
18
19 #include <platform/CHIPDeviceLayer.h>
20 #include <platform/PlatformManager.h>
21
22 #include "af.h"
23 #include "gen/attribute-id.h"
24 #include "gen/cluster-id.h"
25 #include <app/chip-zcl-zpro-codec.h>
26 #include <app/util/af-types.h>
27 #include <app/util/attribute-storage.h>
28 #include <app/util/util.h>
29 #include <core/CHIPError.h>
30 #include <support/CHIPMem.h>
31 #include <support/RandUtils.h>
32
33 #include "Server.h"
34
35 #include <cassert>
36 #include <iostream>
37
38 using namespace chip;
39 using namespace chip::Inet;
40 using namespace chip::Transport;
41 using namespace chip::DeviceLayer;
42
43 void emberAfPostAttributeChangeCallback(EndpointId endpoint, ClusterId clusterId, AttributeId attributeId, uint8_t mask,
44                                         uint16_t manufacturerCode, uint8_t type, uint8_t size, uint8_t * value)
45 {}
46
47 bool emberAfBasicClusterMfgSpecificPingCallback(void)
48 {
49     emberAfSendDefaultResponse(emberAfCurrentCommand(), EMBER_ZCL_STATUS_SUCCESS);
50     return true;
51 }
52
53 int main(int argc, char * argv[])
54 {
55     CHIP_ERROR err = CHIP_NO_ERROR;
56
57     err = chip::Platform::MemoryInit();
58     SuccessOrExit(err);
59
60     err = chip::DeviceLayer::PlatformMgr().InitChipStack();
61     SuccessOrExit(err);
62
63     // Init ZCL Data Model and CHIP App Server
64     InitServer();
65
66     chip::DeviceLayer::PlatformMgr().RunEventLoop();
67
68 exit:
69     if (err != CHIP_NO_ERROR)
70     {
71         std::cerr << "Failed to run All Clusters App: " << ErrorStr(err) << std::endl;
72         // End the program with non zero error code to indicate a error.
73         return 1;
74     }
75     return 0;
76 }