22 #include <FL/fl_ask.H>
29 void changingDeviceCb(Fl_Widget *,
void *user_data)
35 void macCb(Fl_Widget *,
void *user_data)
41 void resetParametersCb(Fl_Widget *,
void *user_data)
47 void resetNetworkCb(Fl_Widget *,
void *user_data)
53 void resetAllCb(Fl_Widget *,
void *user_data)
59 void switchPartitionsCb(Fl_Widget *,
void *user_data)
65 void helpCb(Fl_Widget *,
void *)
100 const std::string &sel_mac)
145 void sendUDPRequest(
const char *mac_string, uint64_t mac_value,
const char *func_name,
152 std::array<uint8_t, 6> mac;
154 mac[0]=
static_cast<uint8_t
>(mac_value>>40);
155 mac[1]=
static_cast<uint8_t
>(mac_value>>32);
156 mac[2]=
static_cast<uint8_t
>(mac_value>>24);
157 mac[3]=
static_cast<uint8_t
>(mac_value>>16);
158 mac[4]=
static_cast<uint8_t
>(mac_value>>8);
159 mac[5]=
static_cast<uint8_t
>(mac_value);
163 std::ostringstream reset_check_str;
164 reset_check_str <<
"Are you sure to " << func_name <<
165 " of rc_visard with MAC-address " << mac_string <<
"?";
166 int answer=fl_choice(
"%s",
"No",
"Yes", 0, reset_check_str.str().c_str());
170 wol.send({{0xEE, 0xEE, 0xEE, func_id}});
171 answer=fl_choice(
"Please check whether rc_visard's LED turned white and whether rc_visard is rebooting.",
172 "Close",
"Try again", 0);
177 fl_alert(
"rcdiscover probably requires root/admin privileges for this operation.");
179 catch (
const std::runtime_error& ex)
181 fl_alert(
"%s", ex.what());
190 sendUDPRequest(
mac->value(),
mac->
getMAC(),
"reset parameters", 0xAA);
196 sendUDPRequest(
mac->value(),
mac->
getMAC(),
"reset network parameters", 0xBB);
202 sendUDPRequest(
mac->value(),
mac->
getMAC(),
"reset all", 0xFF);
208 sendUDPRequest(
mac->value(),
mac->
getMAC(),
"switch partition", 0xCC);
221 device->callback(changingDeviceCb,
this);
240 help->callback(helpCb,
this);
245 size_range(w(), h(), w(), h());