}
switch (answer)
{
case 0:
Logger.getInstance().logError("GSM: Auto-registration disabled!", null, getGateway().getGatewayId());
throw new GatewayException("GSM Network Auto-Registration disabled!");
case 1:
Logger.getInstance().logInfo("GSM: Registered to home network.", null, getGateway().getGatewayId());
return true;
case 2:
Logger.getInstance().logWarn("GSM: Not registered, searching for network...", null, getGateway().getGatewayId());
if (++retries == 6) throw new GatewayException("GSM Network Registration failed, give up trying!");
break;
case 3:
Logger.getInstance().logError("GSM: Network registration denied!", null, getGateway().getGatewayId());
throw new GatewayException("GSM Network Registration denied!");
case 4:
Logger.getInstance().logError("GSM: Unknown registration error!", null, getGateway().getGatewayId());
throw new GatewayException("GSM Network Registration error!");
case 5:
Logger.getInstance().logInfo("GSM: Registered to foreign network (roaming).", null, getGateway().getGatewayId());
return true;
case -1:
Logger.getInstance().logInfo("GSM: Invalid CREG response.", null, getGateway().getGatewayId());
throw new GatewayException("GSM: Invalid CREG response.");
}
Thread.sleep(Service.getInstance().getSettings().AT_WAIT_NETWORK);
}
}