-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.cpp
23 lines (17 loc) · 840 Bytes
/
main.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#include <blickfeld/hardware/client.h>
#include <blickfeld/secure/services/account.grpc.pb.h>
int main() {
auto channel = blickfeld::hardware::connect_to_device("qb2-xxxxxxx", "serial-number-xxx", "application-key-xxxxxxx");
// get authenticated account info
auto service = blickfeld::secure::services::Account::NewStub(channel);
grpc::ClientContext context;
blickfeld::secure::services::AccountGetRequest request;
blickfeld::secure::services::AccountGetResponse response;
auto status = service->Get(&context, request, &response);
if(!status.ok()) {
std::cerr << "Authentication failed: " << status.error_message() << std::endl;
return 1;
}
std::cout << "Authentication successful: " << response.account().DebugString() << std::endl;
return 0;
}