void cDBusMessagePlugin::Process(void) { switch (_action) { case dmpSVDRPCommand: SVDRPCommand(); break; case dmpService: Service(); break; } }
bool cPluginDynamite::SetupParse(const char *Name, const char *Value) { int replyCode; if (strcasecmp(Name, "DefaultGetTSTimeout") == 0) SVDRPCommand("SetDefaultGetTSTimeout", Value, replyCode); else if (strcasecmp(Name, "GetTSTimeoutHandler") == 0) { if (getTSTimeoutHandler != NULL) delete getTSTimeoutHandler; getTSTimeoutHandler = NULL; if (Value != NULL) { getTSTimeoutHandler = new cString(Value); isyslog("dynamite: installing GetTS-Timeout-Handler %s", **getTSTimeoutHandler); } } else if (strcasecmp(Name, "FreeDeviceSlots") == 0) { int tmp = strtol(Value, NULL, 10); if ((tmp >= 0) && (tmp < MAXDEVICES)) freeDeviceSlots = tmp; else esyslog("dynamite: \"%d\" free device slots is out of range", tmp); } else if (strcasecmp(Name, "AttachHook") == 0) { if (cDynamicDevice::attachHook != NULL) delete cDynamicDevice::attachHook; cDynamicDevice::attachHook = NULL; if (Value != NULL) { cDynamicDevice::attachHook = new cString(Value); isyslog("dynamite: installing attach-hook %s", **cDynamicDevice::attachHook); } } else if (strcasecmp(Name, "IdleHook") == 0) { if (cDynamicDevice::idleHook != NULL) delete cDynamicDevice::idleHook; cDynamicDevice::idleHook = NULL; if (Value != NULL) { cDynamicDevice::idleHook = new cString(Value); isyslog("dynamite: installing idle-hook %s", **cDynamicDevice::idleHook); } } else if (strcasecmp(Name, "IdleTimeout") == 0) { int tmp = strtol(Value, NULL, 10); if (tmp >= 0) cDynamicDevice::idleTimeoutMinutes = tmp; } else if (strcasecmp(Name, "IdleWakeup") == 0) { int tmp = strtol(Value, NULL, 10); if (tmp >= 0) cDynamicDevice::idleWakeupHours = tmp; } else return false; return true; }
bool cPluginDynamite::Service(const char *Id, void *Data) { if (strcmp(Id, "dynamite-AttachDevice-v0.1") == 0) { if (Data != NULL) cDynamicDeviceProbe::QueueDynamicDeviceCommand(ddpcAttach, (const char*)Data); return true; } if (strcmp(Id, "dynamite-ScanDevices-v0.1") == 0) { if (Data != NULL) cDynamicDevice::AttachDevicePattern((const char*)Data); return true; } if (strcmp(Id, "dynamite-DetachDevice-v0.1") == 0) { if (Data != NULL) cDynamicDeviceProbe::QueueDynamicDeviceCommand(ddpcDetach, (const char*)Data); return true; } if (strcmp(Id, "dynamite-ForceDetachDevice-v0.1") == 0) { if (Data != NULL) cDynamicDevice::DetachDevice((const char*)Data, true); return true; } if (strcmp(Id, "dynamite-DetachAllDevices-v0.1") == 0) { if (Data != NULL) cDynamicDevice::DetachAllDevices((strcasecmp((const char*)Data, "force") == 0)); return true; } if (strcmp(Id, "dynamite-LockDevice-v0.1") == 0) { if (Data != NULL) cDynamicDevice::SetLockDevice((const char*)Data, true); return true; } if (strcmp(Id, "dynamite-UnlockDevice-v0.1") == 0) { if (Data != NULL) cDynamicDevice::SetLockDevice((const char*)Data, false); return true; } if (strcmp(Id, "dynamite-SetIdle-v0.1") == 0) { if (Data != NULL) cDynamicDevice::SetIdle((const char*)Data, true); return true; } if (strcmp(Id, "dynamite-SetNotIdle-v0.1") == 0) { if (Data != NULL) cDynamicDevice::SetIdle((const char*)Data, false); return true; } if (strcmp(Id, "dynamite-DisableAutoIdle-v0.1") == 0) { if (Data != NULL) cDynamicDevice::SetAutoIdle((const char*)Data, true); return true; } if (strcmp(Id, "dynamite-EnableAutoIdle-v0.1") == 0) { if (Data != NULL) cDynamicDevice::SetAutoIdle((const char*)Data, false); return true; } if (strcmp(Id, "dynamite-SetGetTSTimeout-v0.1") == 0) { if (Data != NULL) { int replyCode; SVDRPCommand("SetGetTSTimeout", (const char*)Data, replyCode); } return true; } if (strcmp(Id, "dynamite-SetDefaultGetTSTimeout-v0.1") == 0) { if (Data != NULL) { int replyCode; SVDRPCommand("SetDefaultGetTSTimeout", (const char*)Data, replyCode); } return true; } if (strcmp(Id, "dynamite-AddUdevMonitor-v0.1") == 0) { if (Data != NULL) { int replyCode; SVDRPCommand("AddUdevMonitor", (const char*)Data, replyCode); } return true; } if (strcmp(Id, "dynamite-SetGetTSTimeoutHandlerArg-v0.1") == 0) { if (Data != NULL) { int replyCode; SVDRPCommand("SetGetTSTimeoutHandlerArg", (const char*)Data, replyCode); } return true; } if (strcmp(Id, "dynamite-CallGetTSTimeoutHandler-v0.1") == 0) { if (Data != NULL) { int replyCode; SVDRPCommand("CallGetTSTimeoutHandler", (const char*)Data, replyCode); } return true; } if (strcmp(Id, "dynamite-SetIdleTimeout-v0.1") == 0) { if (Data != NULL) { int replyCode; SVDRPCommand("SetIdleTimeout", (const char*)Data, replyCode); } return true; } if (strcmp(Id, "dynamite-SetIdleWakeup-v0.1") == 0) { if (Data != NULL) { int replyCode; SVDRPCommand("SetIdleWakeup", (const char*)Data, replyCode); } return true; } return false; }