// Decompiled by Jad v1.5.8e. Copyright 2001 Pavel Kouznetsov. // Jad home page: http://www.geocities.com/kpdus/jad.html // Decompiler options: braces fieldsfirst space lnc package com.philips.lighting.hue.sdk.bridge.impl; import com.philips.lighting.hue.listener.PHBridgeConfigurationListener; import com.philips.lighting.hue.listener.PHGroupListener; import com.philips.lighting.hue.listener.PHLightListener; import com.philips.lighting.hue.listener.PHSceneListener; import com.philips.lighting.hue.listener.PHScheduleListener; import com.philips.lighting.hue.sdk.exception.PHHueInvalidAPIException; import com.philips.lighting.model.PHBridge; import com.philips.lighting.model.PHBridgeConfiguration; import com.philips.lighting.model.PHBridgeResourcesCache; import com.philips.lighting.model.PHGroup; import com.philips.lighting.model.PHLight; import com.philips.lighting.model.PHLightState; import com.philips.lighting.model.PHScene; import com.philips.lighting.model.PHSchedule; import java.util.Hashtable; import java.util.List; // Referenced classes of package com.philips.lighting.hue.sdk.bridge.impl: // PHBridgeResourcesCacheImpl, PHBridgeDelegator public class PHBridgeImpl implements PHBridge { private PHBridgeResourcesCacheImpl cacheImpl; private PHBridgeDelegator delegator; private boolean isPortal; public PHBridgeImpl(PHBridgeDelegator phbridgedelegator) { delegator = phbridgedelegator; cacheImpl = new PHBridgeResourcesCacheImpl(); } public PHBridgeImpl(PHBridgeDelegator phbridgedelegator, boolean flag) { this(phbridgedelegator); isPortal = flag; } public void activateScene(String s, String s1, PHSceneListener phscenelistener) throws PHHueInvalidAPIException { if (isPortal) { throw new PHHueInvalidAPIException("Invalid API call for Portal"); } if (delegator == null) { throw new IllegalArgumentException("Delgator can't be null"); } if (s == null || s1 == null) { throw new IllegalArgumentException("Input parameter can't be null"); } else { delegator.activateScene(s, s1, phscenelistener); return; } } public void createGroup(String s, String as[], PHGroupListener phgrouplistener) throws PHHueInvalidAPIException { if (isPortal) { throw new PHHueInvalidAPIException("Invalid API call for Portal"); } if (delegator == null) { throw new IllegalArgumentException("Delgator can't be null"); } if (as == null || s == null) { throw new IllegalArgumentException("Input parameter can't be null"); } else { delegator.createGroup(s, as, phgrouplistener, this); return; } } public void createSchedule(PHSchedule phschedule, PHScheduleListener phschedulelistener) throws PHHueInvalidAPIException { if (isPortal) { throw new PHHueInvalidAPIException("Invalid API call for Portal"); } if (delegator == null) { throw new IllegalArgumentException("Delgator can't be null"); } if (phschedule == null) { throw new IllegalArgumentException("Input parameter can't be null"); } else { delegator.createSchedule(phschedule, phschedulelistener, this); return; } } public void deleteGroup(String s, PHGroupListener phgrouplistener) throws PHHueInvalidAPIException { if (isPortal) { throw new PHHueInvalidAPIException("Invalid API call for Portal"); } if (delegator == null) { throw new IllegalArgumentException("Delgator can't be null"); } if (s == null) { throw new IllegalArgumentException("Input parameter can't be null"); } else { delegator.deleteGroup(s, phgrouplistener, this); return; } } public void findNewLights(PHLightListener phlightlistener) throws PHHueInvalidAPIException { if (isPortal) { throw new PHHueInvalidAPIException("Invalid API call for Portal"); } if (delegator == null) { throw new IllegalArgumentException("Delgator can't be null"); } else { delegator.findNewLights(phlightlistener); return; } } public void findNewLightsWithSerials(List list, PHLightListener phlightlistener) throws PHHueInvalidAPIException { if (isPortal) { throw new PHHueInvalidAPIException("Invalid API call for Portal"); } if (delegator == null) { throw new IllegalArgumentException("Delgator can't be null"); } if (list == null) { throw new IllegalArgumentException("Input parameter can't be null"); } else { delegator.findNewLightsWithSerials(list, phlightlistener); return; } } public void getAllScenes(PHSceneListener phscenelistener) throws PHHueInvalidAPIException { if (isPortal) { throw new PHHueInvalidAPIException("Invalid API call for Portal"); } if (delegator == null) { throw new IllegalArgumentException("Delgator can't be null"); } else { delegator.getAllScenes(phscenelistener); return; } } public void getBridgeConfigurations(PHBridgeConfigurationListener phbridgeconfigurationlistener) throws PHHueInvalidAPIException { if (isPortal) { throw new PHHueInvalidAPIException("Invalid API call for Portal"); } if (delegator == null) { throw new IllegalArgumentException("Delgator can't be null"); } else { delegator.getBridgeConfigurations(phbridgeconfigurationlistener, this); return; } } public PHBridgeDelegator getBridgeDelegator() { return delegator; } public PHBridgeResourcesCache getResourceCache() { return cacheImpl; } public void removeSchedule(String s, PHScheduleListener phschedulelistener) throws PHHueInvalidAPIException { if (isPortal) { throw new PHHueInvalidAPIException("Invalid API call for Portal"); } if (delegator == null) { throw new IllegalArgumentException("Delgator can't be null"); } if (s == null) { throw new IllegalArgumentException("Input parameter can't be null"); } else { delegator.removeSchedule(s, phschedulelistener, this); return; } } public void removeUsername(String s, PHBridgeConfigurationListener phbridgeconfigurationlistener) throws PHHueInvalidAPIException { if (isPortal) { throw new PHHueInvalidAPIException("Invalid API call for Portal"); } if (delegator == null) { throw new IllegalArgumentException("Delgator can't be null"); } if (s == null) { throw new IllegalArgumentException("Input parameter can't be null"); } else { delegator.removeUsername(s, phbridgeconfigurationlistener); return; } } public void saveLightState(PHLightState phlightstate, String s, String s1, PHSceneListener phscenelistener) throws PHHueInvalidAPIException { if (isPortal) { throw new PHHueInvalidAPIException("Invalid API call for Portal"); } if (delegator == null) { throw new IllegalArgumentException("Delgator can't be null"); } if (phlightstate == null || s == null || s1 == null) { throw new IllegalArgumentException("Input parameter can't be null"); } else { delegator.saveLightState(phlightstate, s, s1, phscenelistener); return; } } public void saveScene(PHScene phscene, PHSceneListener phscenelistener) throws PHHueInvalidAPIException { if (isPortal) { throw new PHHueInvalidAPIException("Invalid API call for Portal"); } if (delegator == null) { throw new IllegalArgumentException("Delgator can't be null"); } if (phscene == null) { throw new IllegalArgumentException("Input parameter can't be null"); } else { delegator.saveScene(phscene, phscenelistener); return; } } public void saveSceneWithCurrentLightStates(PHScene phscene, PHSceneListener phscenelistener) throws PHHueInvalidAPIException { if (isPortal) { throw new PHHueInvalidAPIException("Invalid API call for Portal"); } if (delegator == null) { throw new IllegalArgumentException("Delgator can't be null"); } if (phscene == null) { throw new IllegalArgumentException("Input parameter can't be null"); } else { delegator.saveScene(phscene, phscenelistener); return; } } public void setLightStateForDefaultGroup(PHLightState phlightstate) { setLightStateForGroup("0", phlightstate); } public void setLightStateForGroup(String s, PHLightState phlightstate) { PHGroupListener phgrouplistener = new PHGroupListener() { final PHBridgeImpl this$0; public void onError(int i, String s1) { } public void onStateUpdate(Hashtable hashtable, List list) { } public void onSuccess() { } { this$0 = PHBridgeImpl.this; super(); } }; if (delegator == null) { throw new IllegalArgumentException("Delgator can't be null"); } if (s == null) { throw new IllegalArgumentException("Input parameter can't be null"); } if (phlightstate == null) { throw new IllegalArgumentException("Input parameter can't be null"); } else { delegator.setLightStateForGroup(s, phlightstate, phgrouplistener, this); return; } } public void setLightStateForGroup(String s, PHLightState phlightstate, PHGroupListener phgrouplistener) { if (delegator == null) { throw new IllegalArgumentException("Delgator can't be null"); } if (s == null) { throw new IllegalArgumentException("Input parameter can't be null"); } if (phlightstate == null) { throw new IllegalArgumentException("Input parameter can't be null"); } else { delegator.setLightStateForGroup(s, phlightstate, phgrouplistener, this); return; } } public void updateBridgeConfigurations(PHBridgeConfiguration phbridgeconfiguration, PHBridgeConfigurationListener phbridgeconfigurationlistener) throws PHHueInvalidAPIException { if (isPortal) { throw new PHHueInvalidAPIException("Invalid API call for Portal"); } if (phbridgeconfiguration == null) { throw new IllegalArgumentException("Input parameter can't be null"); } if (delegator == null) { throw new IllegalArgumentException("Delgator can't be null"); } else { delegator.updateBridgeConfigurations(phbridgeconfiguration, phbridgeconfigurationlistener, this); return; } } public void updateGroup(PHGroup phgroup, PHGroupListener phgrouplistener) throws PHHueInvalidAPIException { if (isPortal) { throw new PHHueInvalidAPIException("Invalid API call for Portal"); } if (delegator == null) { throw new IllegalArgumentException("Delgator can't be null"); } if (phgroup == null) { throw new IllegalArgumentException("Input parameter can't be null"); } else { delegator.updateGroup(phgroup, phgrouplistener, this); return; } } public void updateLight(PHLight phlight, PHLightListener phlightlistener) throws PHHueInvalidAPIException { if (isPortal) { throw new PHHueInvalidAPIException("Invalid API call for Portal"); } if (delegator == null) { throw new IllegalArgumentException("Delgator can't be null"); } if (phlight == null) { throw new IllegalArgumentException("Input parameter can't be null"); } else { delegator.updateLight(phlight, phlightlistener, this); return; } } public void updateLightState(PHLight phlight, PHLightState phlightstate) { PHLightListener phlightlistener = new PHLightListener() { final PHBridgeImpl this$0; public void onError(int i, String s) { } public void onStateUpdate(Hashtable hashtable, List list) { } public void onSuccess() { } { this$0 = PHBridgeImpl.this; super(); } }; delegator.updateLightState(phlight.getIdentifier(), phlightstate, phlightlistener, this); } public void updateLightState(PHLight phlight, PHLightState phlightstate, PHLightListener phlightlistener) { delegator.updateLightState(phlight.getIdentifier(), phlightstate, phlightlistener, this); } public void updateLightState(String s, PHLightState phlightstate, PHLightListener phlightlistener) { if (delegator == null) { throw new IllegalArgumentException("Delgator can't be null"); } if (s == null || phlightstate == null) { throw new IllegalArgumentException("Input parameter can't be null"); } else { delegator.updateLightState(s, phlightstate, phlightlistener, this); return; } } public void updateSchedule(PHSchedule phschedule, PHScheduleListener phschedulelistener) throws PHHueInvalidAPIException { if (isPortal) { throw new PHHueInvalidAPIException("Invalid API call for Portal"); } if (delegator == null) { throw new IllegalArgumentException("Delgator can't be null"); } if (phschedule == null) { throw new IllegalArgumentException("Input parameter can't be null"); } else { delegator.updateSchedule(phschedule, phschedulelistener, this); return; } } public void updateSoftware(PHBridgeConfigurationListener phbridgeconfigurationlistener) throws PHHueInvalidAPIException { if (isPortal) { throw new PHHueInvalidAPIException("Invalid API call for Portal"); } if (delegator == null) { throw new IllegalArgumentException("Delgator can't be null"); } else { delegator.updateSoftware(phbridgeconfigurationlistener, this); return; } } }