Skip to content
This repository has been archived by the owner on Nov 12, 2020. It is now read-only.

Commit

Permalink
fixes #2
Browse files Browse the repository at this point in the history
At first start, no scenes are configured
line 1157/1158 would kill the server for no reason
  • Loading branch information
wburgers committed Dec 26, 2014
1 parent 5db040c commit 9197fc3
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions Server/Main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ static pthread_cond_t initCond = PTHREAD_COND_INITIALIZER;
static pthread_mutex_t initMutex = PTHREAD_MUTEX_INITIALIZER;

// Value-Defintions of the different String values
enum Commands {Undefined_command = 0, AList, SetNode, RoomListC, RoomC, Plus, Minus, SceneListC, SceneC, Create, Add, Remove, Activate, ControllerC, Cancel, Cron, Switch, AtHome, PollInterval, AlarmList, Test, Exit};
enum Commands {Undefined_command = 0, AList, SetNode, RoomListC, RoomC, Plus, Minus, SceneListC, SceneC, Create, Add, Remove, Activate, ControllerC, Cancel, Reset, Cron, Switch, AtHome, PollInterval, AlarmList, Test, Exit};
enum Triggers {Undefined_trigger = 0, Sunrise, Sunset, Thermostat, Update};
enum DeviceOptions {Undefined_Option = 0, Name, Location, Level, Thermostat_Setpoint, Polling, Wake_up_Interval, Battery_report};
static std::map<std::string, Commands> s_mapStringCommands;
Expand All @@ -180,6 +180,7 @@ void create_string_maps() {
s_mapStringCommands["ACTIVATE"] = Activate;
s_mapStringCommands["CONTROLLER"] = ControllerC;
s_mapStringCommands["CANCEL"] = Cancel;
s_mapStringCommands["RESET"] = Reset;
s_mapStringCommands["CRON"] = Cron;
s_mapStringCommands["SWITCH"] = Switch;
s_mapStringCommands["ATHOME"] = AtHome;
Expand Down Expand Up @@ -1154,10 +1155,6 @@ bool init_Scenes() {
uint8 numscenes = 0;
uint8 *sceneIds = new uint8[numscenes];

if((numscenes = Manager::Get()->GetAllScenes(&sceneIds))==0) {
return false;
}

int scid=0;

for(int i=0; i<numscenes; ++i) {
Expand Down Expand Up @@ -1666,6 +1663,10 @@ std::string process_commands(std::string data) {
output += response;
break;
}
case Reset: {
Manager::Get()->ResetController(g_homeId);
break;
}
default:
break;
}
Expand Down

0 comments on commit 9197fc3

Please sign in to comment.