mainapp.cpp (7047be6784455faa71f16ebbc66a74040634e350) mainapp.cpp (b3dbfb37a6624153d5c27d87fc07d95e36bef352)
1/**
2 * Copyright © 2018 IBM Corporation
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0

--- 37 unchanged lines hidden (view full) ---

46 {
47 std::exit(EXIT_FAILURE);
48 }
49
50 auto bus = sdbusplus::bus::new_default();
51 auto objPath = std::string(objectNamePrefix) + '/' + arguments.typeStr +
52 '/' + arguments.endpoint;
53 // Add sdbusplus ObjectManager
1/**
2 * Copyright © 2018 IBM Corporation
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0

--- 37 unchanged lines hidden (view full) ---

46 {
47 std::exit(EXIT_FAILURE);
48 }
49
50 auto bus = sdbusplus::bus::new_default();
51 auto objPath = std::string(objectNamePrefix) + '/' + arguments.typeStr +
52 '/' + arguments.endpoint;
53 // Add sdbusplus ObjectManager
54 sdbusplus::server::manager::manager objManager(bus, objPath.c_str());
54 sdbusplus::server::manager_t objManager(bus, objPath.c_str());
55
56 // Get default event loop
57 auto event = sdeventplus::Event::get_default();
58
59 // Attach the bus to sd_event to service user requests
60 bus.attach_event(event.get(), SD_EVENT_PRIORITY_NORMAL);
61 phosphor::certs::Manager manager(
62 bus, event, objPath.c_str(),
63 phosphor::certs::stringToCertificateType(arguments.typeStr),
64 arguments.unit, arguments.path);
65
66 // Adjusting Interface name as per std convention
67 auto busName = std::string(busNamePrefix) + '.' +
68 capitalize(arguments.typeStr) + '.' +
69 capitalize(arguments.endpoint);
70 bus.request_name(busName.c_str());
71 event.loop();
72 return 0;
73}
55
56 // Get default event loop
57 auto event = sdeventplus::Event::get_default();
58
59 // Attach the bus to sd_event to service user requests
60 bus.attach_event(event.get(), SD_EVENT_PRIORITY_NORMAL);
61 phosphor::certs::Manager manager(
62 bus, event, objPath.c_str(),
63 phosphor::certs::stringToCertificateType(arguments.typeStr),
64 arguments.unit, arguments.path);
65
66 // Adjusting Interface name as per std convention
67 auto busName = std::string(busNamePrefix) + '.' +
68 capitalize(arguments.typeStr) + '.' +
69 capitalize(arguments.endpoint);
70 bus.request_name(busName.c_str());
71 event.loop();
72 return 0;
73}