blob: f6cb665185de68d87543b9f3b230ea64cd7c9420 [file] [log] [blame]
Gunnar Mills72639152017-06-22 15:06:21 -05001#include <iostream>
2#include <phosphor-logging/log.hpp>
3#include "argument.hpp"
4#include "gpio_presence.hpp"
5
6using namespace phosphor::logging;
7using namespace phosphor::gpio;
Gunnar Mills5f101102017-06-29 13:07:39 -05008using namespace phosphor::gpio::presence;
Gunnar Mills72639152017-06-22 15:06:21 -05009
10int main(int argc, char* argv[])
11{
12 auto options = ArgumentParser(argc, argv);
13
14 auto inventory = options["inventory"];
15 auto key = options["key"];
16 auto path = options["path"];
17 if (argc < 4)
18 {
19 std::cerr << "Too few arguments\n";
20 options.usage(argv);
21 }
22
23 if (inventory == ArgumentParser::emptyString)
24 {
25 std::cerr << "Inventory argument required\n";
26 options.usage(argv);
27 }
28
29 if (key == ArgumentParser::emptyString)
30 {
31 std::cerr << "GPIO key argument required\n";
32 options.usage(argv);
33 }
34
35 if (path == ArgumentParser::emptyString)
36 {
37 std::cerr << "Device path argument required\n";
38 options.usage(argv);
39 }
Gunnar Mills80292bb2017-07-05 16:34:51 -050040
41 auto bus = sdbusplus::bus::new_default();
42 auto name = options["name"];
43 Presence presence(bus, inventory, path, std::stoul(key), name);
Gunnar Mills72639152017-06-22 15:06:21 -050044
45 return 0;
46}
47