├── examples ├── ic_launcher-web.png ├── res │ ├── drawable-xhdpi │ │ └── ic_launcher.png │ ├── values-sw600dp │ │ └── dimens.xml │ ├── values │ │ ├── dimens.xml │ │ ├── strings.xml │ │ └── styles.xml │ ├── menu │ │ └── sample.xml │ ├── values-sw720dp-land │ │ └── dimens.xml │ ├── values-v11 │ │ └── styles.xml │ ├── values-v14 │ │ └── styles.xml │ └── layout │ │ ├── lifx_list_item_layout.xml │ │ ├── lifx_main_activity_layout.xml │ │ └── lifx_list_sample_layout.xml ├── project.properties ├── proguard-project.txt ├── src │ └── com │ │ └── example │ │ └── lifx_sdk_samples │ │ ├── LFXSDKLightListAdapter.java │ │ ├── LFXSDKTaggedLightCollectionListAdapter.java │ │ ├── LFXSDKSamplesActivity.java │ │ ├── LFXSDKLightRandomColorActivity.java │ │ ├── LFXSDKLightPowerActivity.java │ │ └── LFXSDKLightEditLabelActivity.java └── AndroidManifest.xml ├── library ├── AndroidManifest.xml ├── src │ └── lifx │ │ └── java │ │ └── android │ │ ├── network_context │ │ └── internal │ │ │ ├── transport_manager │ │ │ ├── gateway_connection │ │ │ │ ├── LFXTCPGatewayConnection.java │ │ │ │ ├── LFXGatewayConnection.java │ │ │ │ ├── LFXSocketUDP.java │ │ │ │ ├── LFXSocketTCP.java │ │ │ │ ├── LFXSocketGeneric.java │ │ │ │ └── LFXUDPGatewayConnection.java │ │ │ ├── lan │ │ │ │ ├── gateway_discovery │ │ │ │ │ ├── LFXGatewayDiscoveryTableEntry.java │ │ │ │ │ └── LFXGatewayDiscoveryController.java │ │ │ │ └── LFXLANTransportManager.java │ │ │ └── LFXTransportManager.java │ │ │ └── routing_table │ │ │ └── LFXRoutingTable.java │ │ ├── constant │ │ └── LFXSDKConstants.java │ │ ├── entities │ │ ├── LFXTypes.java │ │ ├── internal │ │ │ ├── LFXDeviceMapping.java │ │ │ ├── LFXTagMapping.java │ │ │ ├── LFXMessageObservationDescriptor.java │ │ │ ├── LFXSiteID.java │ │ │ ├── LFXBinaryPath.java │ │ │ ├── LFXBinaryTypes.java │ │ │ ├── LFXTarget.java │ │ │ ├── LFXGatewayDescriptor.java │ │ │ ├── LFXBinaryTargetID.java │ │ │ └── structle │ │ │ │ └── LxProtocolSensor.java │ │ ├── LFXLightTarget.java │ │ └── LFXHSBKColor.java │ │ ├── util │ │ ├── LFXLog.java │ │ ├── LFXTimerUtils.java │ │ ├── LFXByteUtils.java │ │ └── LFXNetworkUtils.java │ │ ├── client │ │ └── LFXClient.java │ │ ├── light │ │ ├── internal │ │ │ └── LFXAllLightsCollection.java │ │ ├── LFXTaggedLightCollection.java │ │ ├── LFXLightCollection.java │ │ └── LFXLight.java │ │ └── internal │ │ └── LFXWiFiObserver.java ├── project.properties └── proguard-project.txt ├── .gitignore ├── README.md └── LICENSE /examples/ic_launcher-web.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LIFX/lifx-sdk-android/HEAD/examples/ic_launcher-web.png -------------------------------------------------------------------------------- /examples/res/drawable-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LIFX/lifx-sdk-android/HEAD/examples/res/drawable-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /examples/res/values-sw600dp/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /examples/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 16dp 5 | 16dp 6 | 7 | 8 | -------------------------------------------------------------------------------- /examples/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | LIFX_SDK_SAMPLES 5 | Settings 6 | Hello world! 7 | 8 | 9 | -------------------------------------------------------------------------------- /examples/res/menu/sample.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /examples/res/values-sw720dp-land/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 128dp 8 | 9 | 10 | -------------------------------------------------------------------------------- /examples/res/values-v11/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /library/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 9 | 10 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Eclipse 2 | .project 3 | .classpath 4 | .settings 5 | .checkstyle 6 | 7 | # IntelliJ IDEA 8 | .idea 9 | *.iml 10 | *.ipr 11 | *.iws 12 | classes 13 | gen-external-apklibs 14 | 15 | # Gradle 16 | .gradle 17 | build 18 | 19 | # Maven 20 | target 21 | release.properties 22 | pom.xml.* 23 | 24 | # Ant 25 | bin 26 | gen 27 | build.xml 28 | ant.properties 29 | local.properties 30 | proguard.cfg 31 | proguard-project.txt 32 | 33 | # Other 34 | .DS_Store -------------------------------------------------------------------------------- /examples/res/values-v14/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /library/src/lifx/java/android/network_context/internal/transport_manager/gateway_connection/LFXTCPGatewayConnection.java: -------------------------------------------------------------------------------- 1 | // 2 | // LFXTCPGatewayConnection.java 3 | // LIFX 4 | // 5 | // Created by Jarrod Boyes on 24/03/14. 6 | // Copyright (c) 2014 LIFX Labs. All rights reserved. 7 | // 8 | 9 | package lifx.java.android.network_context.internal.transport_manager.gateway_connection; 10 | 11 | public class LFXTCPGatewayConnection { 12 | private final static String TAG = LFXTCPGatewayConnection.class.getSimpleName(); 13 | } 14 | -------------------------------------------------------------------------------- /library/project.properties: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by Android Tools. 2 | # Do not modify this file -- YOUR CHANGES WILL BE ERASED! 3 | # 4 | # This file must be checked in Version Control Systems. 5 | # 6 | # To customize properties used by the Ant build system edit 7 | # "ant.properties", and override values to adapt the script to your 8 | # project structure. 9 | # 10 | # To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home): 11 | #proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt 12 | 13 | # Project target. 14 | target=android-19 15 | android.library=true 16 | -------------------------------------------------------------------------------- /examples/project.properties: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by Android Tools. 2 | # Do not modify this file -- YOUR CHANGES WILL BE ERASED! 3 | # 4 | # This file must be checked in Version Control Systems. 5 | # 6 | # To customize properties used by the Ant build system edit 7 | # "ant.properties", and override values to adapt the script to your 8 | # project structure. 9 | # 10 | # To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home): 11 | #proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt 12 | 13 | # Project target. 14 | target=android-19 15 | android.library.reference.1=../LIFX_SDK 16 | -------------------------------------------------------------------------------- /examples/res/layout/lifx_list_item_layout.xml: -------------------------------------------------------------------------------- 1 | 10 | 11 | 16 | 17 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /examples/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 14 | 15 | 16 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /library/src/lifx/java/android/constant/LFXSDKConstants.java: -------------------------------------------------------------------------------- 1 | // 2 | // LFXSDKConstants.java 3 | // LIFX 4 | // 5 | // Created by Jarrod Boyes on 24/03/14. 6 | // Copyright (c) 2014 LIFX Labs. All rights reserved. 7 | // 8 | 9 | package lifx.java.android.constant; 10 | 11 | public class LFXSDKConstants { 12 | public static final long LFX_UDP_MESSAGE_SEND_RATE_LIMIT_INTERVAL = 200; 13 | public static final long LFX_UDP_HEARTBEAT_INTERVAL = 15000; 14 | public static final long LFX_UDP_IDLE_TIMEOUT_INTERVAL = 20000; 15 | 16 | public static final long LFX_TCP_MESSAGE_SEND_RATE_LIMIT_INTERVAL = 200; 17 | public static final long LFX_TCP_HEARTBEAT_INTERVAL = 15000; 18 | public static final long LFX_TCP_IDLE_TIMEOUT_INTERVAL = 20000; 19 | 20 | public static final long LFX_SITE_SCAN_TIMER_INTERVAL = 30000; 21 | } 22 | 23 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # LIFX 2 | 3 | LIFX will no longer be supporting lifx-sdk-android. This has been done in order to better support developers by focusing instead on releasing documentation for the LAN protocol itself and enabling SDKs to be produced in any language. We have also published a HTTP API cloud-based light control from anywhere. 4 | 5 | Our Developer Zone is available if you have any questions about using the newly released documentation. You can find it at https://community.lifx.com/ 6 | 7 | We sincerely hope that someone decides to fork this repository and continues maintaining it. If you do this please feel free to let us know on the Developer Zone or by email at developers@lifx.com. We will do our best to support your efforts. 8 | 9 | We hope that our new commitment to support public documentation allows better quality libraries than we have the resources to support alone. 10 | -------------------------------------------------------------------------------- /examples/proguard-project.txt: -------------------------------------------------------------------------------- 1 | # To enable ProGuard in your project, edit project.properties 2 | # to define the proguard.config property as described in that file. 3 | # 4 | # Add project specific ProGuard rules here. 5 | # By default, the flags in this file are appended to flags specified 6 | # in ${sdk.dir}/tools/proguard/proguard-android.txt 7 | # You can edit the include path and order by changing the ProGuard 8 | # include property in project.properties. 9 | # 10 | # For more details, see 11 | # http://developer.android.com/guide/developing/tools/proguard.html 12 | 13 | # Add any project specific keep options here: 14 | 15 | # If your project uses WebView with JS, uncomment the following 16 | # and specify the fully qualified class name to the JavaScript interface 17 | # class: 18 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 19 | # public *; 20 | #} 21 | -------------------------------------------------------------------------------- /library/proguard-project.txt: -------------------------------------------------------------------------------- 1 | # To enable ProGuard in your project, edit project.properties 2 | # to define the proguard.config property as described in that file. 3 | # 4 | # Add project specific ProGuard rules here. 5 | # By default, the flags in this file are appended to flags specified 6 | # in ${sdk.dir}/tools/proguard/proguard-android.txt 7 | # You can edit the include path and order by changing the ProGuard 8 | # include property in project.properties. 9 | # 10 | # For more details, see 11 | # http://developer.android.com/guide/developing/tools/proguard.html 12 | 13 | # Add any project specific keep options here: 14 | 15 | # If your project uses WebView with JS, uncomment the following 16 | # and specify the fully qualified class name to the JavaScript interface 17 | # class: 18 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 19 | # public *; 20 | #} 21 | -------------------------------------------------------------------------------- /library/src/lifx/java/android/entities/LFXTypes.java: -------------------------------------------------------------------------------- 1 | // 2 | // LFXTypes.java 3 | // LIFX 4 | // 5 | // Created by Jarrod Boyes on 24/03/14. 6 | // Copyright (c) 2014 LIFX Labs. All rights reserved. 7 | // 8 | 9 | package lifx.java.android.entities; 10 | 11 | public class LFXTypes { 12 | public enum LFXDeviceReachability { 13 | REACHABLE, 14 | UNREACHABLE, 15 | } 16 | 17 | public enum LFXFuzzyPowerState { 18 | OFF, 19 | ON, 20 | MIXED, 21 | } 22 | 23 | public enum LFXPowerState { 24 | ON, 25 | OFF, 26 | } 27 | 28 | public static LFXFuzzyPowerState getLFXFuzzyPowerStateFromPowerState(LFXPowerState powerState) { 29 | switch (powerState) { 30 | case OFF: 31 | return LFXFuzzyPowerState.OFF; 32 | case ON: 33 | return LFXFuzzyPowerState.ON; 34 | } 35 | return LFXFuzzyPowerState.OFF; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /library/src/lifx/java/android/util/LFXLog.java: -------------------------------------------------------------------------------- 1 | // 2 | // LFXLog.java 3 | // LIFX 4 | // 5 | // Created by Jarrod Boyes on 24/03/14. 6 | // Copyright (c) 2014 LIFX Labs. All rights reserved. 7 | // 8 | 9 | package lifx.java.android.util; 10 | 11 | import android.util.Log; 12 | 13 | public class LFXLog { 14 | private static boolean info = true; 15 | private static boolean error = true; 16 | private static boolean warning = true; 17 | private static boolean verbose = true; 18 | private static boolean debug = true; 19 | 20 | public static void i(String tag, String input) { 21 | if (info) Log.i(tag, input); 22 | } 23 | 24 | public static void e(String tag, String input) { 25 | if (error) Log.e(tag, input); 26 | } 27 | 28 | public static void w(String tag, String input) { 29 | if (warning) Log.w(tag, input); 30 | } 31 | 32 | public static void v(String tag, String input) { 33 | if (verbose) Log.v(tag, input); 34 | } 35 | 36 | public static void d(String tag, String input) { 37 | if (debug) Log.d(tag, input); 38 | } 39 | 40 | } 41 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 LIFX Labs 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /library/src/lifx/java/android/network_context/internal/transport_manager/lan/gateway_discovery/LFXGatewayDiscoveryTableEntry.java: -------------------------------------------------------------------------------- 1 | // 2 | // LFXGatewayDiscoveryTableEntry.java 3 | // LIFX 4 | // 5 | // Created by Jarrod Boyes on 24/03/14. 6 | // Copyright (c) 2014 LIFX Labs. All rights reserved. 7 | // 8 | 9 | package lifx.java.android.network_context.internal.transport_manager.lan.gateway_discovery; 10 | 11 | import lifx.java.android.entities.internal.LFXGatewayDescriptor; 12 | 13 | public class LFXGatewayDiscoveryTableEntry { 14 | private LFXGatewayDescriptor gatewayDescriptor; 15 | private long lastDiscoveryResponseDate; 16 | 17 | public LFXGatewayDescriptor getGatewayDescriptor() { 18 | return gatewayDescriptor; 19 | } 20 | 21 | public void setGatewayDescriptor(LFXGatewayDescriptor gatewayDescriptor) { 22 | this.gatewayDescriptor = gatewayDescriptor; 23 | } 24 | 25 | public long getLastDiscoveryResponseDate() { 26 | return lastDiscoveryResponseDate; 27 | } 28 | 29 | public void setLastDiscoveryResponseDate(long lastDiscoveryResponseDate) { 30 | this.lastDiscoveryResponseDate = lastDiscoveryResponseDate; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /library/src/lifx/java/android/entities/internal/LFXDeviceMapping.java: -------------------------------------------------------------------------------- 1 | // 2 | // LFXDeviceMapping.java 3 | // LIFX 4 | // 5 | // Created by Jarrod Boyes on 24/03/14. 6 | // Copyright (c) 2014 LIFX Labs. All rights reserved. 7 | // 8 | 9 | package lifx.java.android.entities.internal; 10 | 11 | import lifx.java.android.entities.internal.LFXBinaryTargetID.TagField; 12 | 13 | public class LFXDeviceMapping { 14 | private String deviceID; 15 | 16 | private LFXSiteID siteID; 17 | private TagField tagField = new TagField(); 18 | 19 | public boolean matchesDeviceID(String deviceID) { 20 | return this.deviceID.equals(deviceID); 21 | } 22 | 23 | public void setDeviceID(String deviceID) { 24 | this.deviceID = deviceID; 25 | } 26 | 27 | public void setSiteID(LFXSiteID siteID) { 28 | this.siteID = siteID; 29 | } 30 | 31 | public void setTagField(TagField tagField) { 32 | this.tagField = tagField; 33 | } 34 | 35 | public String getDeviceId() { 36 | return deviceID; 37 | } 38 | 39 | public LFXSiteID getSiteID() { 40 | return siteID; 41 | } 42 | 43 | public TagField getTagField() { 44 | return tagField; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /library/src/lifx/java/android/entities/internal/LFXTagMapping.java: -------------------------------------------------------------------------------- 1 | // 2 | // LFXTagMapping.java 3 | // LIFX 4 | // 5 | // Created by Jarrod Boyes on 24/03/14. 6 | // Copyright (c) 2014 LIFX Labs. All rights reserved. 7 | // 8 | 9 | package lifx.java.android.entities.internal; 10 | 11 | import lifx.java.android.entities.internal.LFXBinaryTargetID.TagField; 12 | 13 | public class LFXTagMapping 14 | { 15 | private String tag; 16 | 17 | private LFXSiteID siteID; 18 | private TagField tagField; 19 | 20 | // Use this for uniqueing a TagMapping 21 | public boolean matchesSiteIDAndTagField( LFXSiteID siteID, TagField tagField) 22 | { 23 | return tagField.equals( this.tagField) && siteID.equals( this.siteID); 24 | } 25 | 26 | // Use this for routing outgoing messages 27 | public boolean matchesTag( String tag) 28 | { 29 | return tag.equals( this.tag); 30 | } 31 | 32 | public void setTagField( TagField tagField) 33 | { 34 | this.tagField = tagField; 35 | } 36 | 37 | public void setTag( String tag) 38 | { 39 | this.tag = tag; 40 | } 41 | 42 | public void setSiteID( LFXSiteID siteID) 43 | { 44 | this.siteID = siteID; 45 | } 46 | 47 | public TagField getTagField() 48 | { 49 | return tagField; 50 | } 51 | 52 | public String getTag() 53 | { 54 | return tag; 55 | } 56 | 57 | public LFXSiteID getSiteID() 58 | { 59 | return siteID; 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /examples/res/layout/lifx_main_activity_layout.xml: -------------------------------------------------------------------------------- 1 | 10 | 11 | 17 | 18 | 23 | 24 |