예제 #1
0
int FwDaemon::OnInit() {
    LOG(INFO) << "Waiting for commands...";
    int return_code = brillo::DBusDaemon::OnInit();
    if (return_code != EX_OK) {
        return return_code;
    }

    firewall_->WaitForServiceAsync(bus_.get(), base::Bind(&FwDaemon::OnFirewallServiceOnline,
            weak_ptr_factory_.GetWeakPtr()));

    return EX_OK;
}
void MyDaemon::sketch_loop(unsigned delay_in_msec)
{
	extern void printCharWithShift(char c, int shift_speed);
	if (pos >= display.length()) {
		display = on_off_service_->getDisplayText();
		pos = 0;
	}
	if (display.length() > 0)
		printCharWithShift(display[pos++], 100);
	brillo::MessageLoop::current()->PostDelayedTask(
			base::Bind(&MyDaemon::sketch_loop, weak_ptr_factory_.GetWeakPtr(), delay_in_msec),
			base::TimeDelta::FromMilliseconds(delay_in_msec));
}
예제 #3
0
void FwDaemon::OnFirewallServiceOnline() {
    LOG(INFO) << "Firewall service is on-line. ";
    firewall_->PunchTcpHoleAsync(port_, "",
            base::Bind(&FwDaemon::OnFirewallSuccess, weak_ptr_factory_.GetWeakPtr(), "", port_),
            base::Bind(&FwDaemon::IgnoreFirewallDBusMethodError, weak_ptr_factory_.GetWeakPtr()));
}