forked from HBM/devscan
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configureinterface.cpp
31 lines (27 loc) · 957 Bytes
/
configureinterface.cpp
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
// Copyright 2014 Hottinger Baldwin Messtechnik
// Distributed under MIT license
// See file LICENSE provided
#include <iostream>
#include "devscan/configureclient.h"
int main(int argc, char* argv[])
{
if( argc!=6 ) {
std::cout << "syntax: " << argv[0] << " <uuid of the device> <interface name> dhcp|manual <manual address> <manual netmask>" << std::endl;
return 0;
}
std::string uuid = argv[1];
std::string interfaceName = argv[2];
std::string method = argv[3];
std::string manualAddress = argv[4];
std::string manualNetmask = argv[5];
hbm::devscan::ConfigureClient configureClient;
try {
std::string result = configureClient.setInterfaceConfiguration("", 1, uuid, interfaceName, method, manualAddress, manualNetmask);
std::cout << result << std::endl;
} catch (std::runtime_error& e) {
std::cerr << "Error: set configuration failed" << std::endl;
std::cerr << "EXCEPTION: " << e.what() << std::endl;
return 1;
}
return 0;
}