forked from Azure/iot-edge-v1
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.c
52 lines (47 loc) · 1.45 KB
/
main.c
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
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
#include <stdio.h>
#include "simulated_device_cloud_upload_config_service.h"
#include "gateway.h"
#include "azure_c_shared_utility/xlogging.h"
#include "azure_c_shared_utility/vector.h"
#include "azure_c_shared_utility/platform.h"
int main(int argc, char** argv)
{
GATEWAY_HANDLE deviceCloudUploadGateway;
if (argc != 2)
{
printf("usage: simulated_device_cloud_upload gatewayConfigFile\n");
printf("gatewayConfigFile is a JSON configuration file \n");
}
else
{
if (platform_init() == 0)
{
if (configureAsAService() != 0)
{
LogError("Could not configure gateway as a service.");
}
else
{
deviceCloudUploadGateway = Gateway_CreateFromJson(argv[1]);
if (deviceCloudUploadGateway == NULL)
{
LogError("Failed to create gateway");
}
else
{
/* Wait for user input to quit. */
waitForUserInput();
Gateway_Destroy(deviceCloudUploadGateway);
}
}
platform_deinit();
}
else
{
LogError("Failed to initialize the platform.");
}
}
return 0;
}