Skip to content
This repository has been archived by the owner on Oct 15, 2024. It is now read-only.

Commit

Permalink
Merge pull request #17 from awong1900/dev_setup_prove
Browse files Browse the repository at this point in the history
Dev setup prove
  • Loading branch information
awong1900 committed Nov 2, 2015
2 parents c8cfc1e + b685dfc commit 1d9e602
Show file tree
Hide file tree
Showing 109 changed files with 2,074 additions and 863 deletions.
Binary file added android/app/app-release.apk
Binary file not shown.
29 changes: 15 additions & 14 deletions android/app/app.iml
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,12 @@
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dependency-cache" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dex" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dex-cache" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/appcompat-v7/23.0.1/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/cardview-v7/23.0.1/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/design/23.0.1/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/recyclerview-v7/23.0.1/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/support-v13/23.0.1/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/support-v4/23.0.1/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/appcompat-v7/23.1.0/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/cardview-v7/23.1.0/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/design/23.1.0/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/recyclerview-v7/23.1.0/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/support-v13/23.1.0/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/support-v4/23.1.0/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.daimajia.swipelayout/library/1.1.8/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.ikimuhendis/ldrawer/0.1/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/de.hdodenhof/circleimageview/2.0.0/jars" />
Expand All @@ -101,21 +101,22 @@
<orderEntry type="library" exported="" name="gson-2.3.1" level="project" />
<orderEntry type="library" exported="" name="library-2.4.1" level="project" />
<orderEntry type="library" exported="" name="android-integration-3.2.0" level="project" />
<orderEntry type="library" exported="" name="cardview-v7-23.0.1" level="project" />
<orderEntry type="library" exported="" name="cardview-v7-23.1.0" level="project" />
<orderEntry type="library" exported="" name="activeandroid-3.1.0-SNAPSHOT" level="project" />
<orderEntry type="library" exported="" name="retrofit-1.9.0" level="project" />
<orderEntry type="library" exported="" name="design-23.0.1" level="project" />
<orderEntry type="library" exported="" name="design-23.1.0" level="project" />
<orderEntry type="library" exported="" name="urlimageviewhelper-1.0.4" level="project" />
<orderEntry type="library" exported="" name="circleimageview-2.0.0" level="project" />
<orderEntry type="library" exported="" name="library-1.1.8" level="project" />
<orderEntry type="library" exported="" name="recyclerview-v7-23.0.1" level="project" />
<orderEntry type="library" exported="" name="recyclerview-v7-23.1.0" level="project" />
<orderEntry type="library" exported="" name="ldrawer-0.1" level="project" />
<orderEntry type="library" exported="" name="yamlbeans-1.09" level="project" />
<orderEntry type="library" exported="" name="core-3.2.0" level="project" />
<orderEntry type="library" exported="" name="okhttp-2.2.0" level="project" />
<orderEntry type="library" exported="" name="support-v13-23.0.1" level="project" />
<orderEntry type="library" exported="" name="support-v4-23.0.1" level="project" />
<orderEntry type="library" exported="" name="appcompat-v7-23.0.1" level="project" />
<orderEntry type="library" exported="" name="core-3.2.0" level="project" />
<orderEntry type="library" exported="" name="support-v13-23.1.0" level="project" />
<orderEntry type="library" exported="" name="support-v4-23.1.0" level="project" />
<orderEntry type="library" exported="" name="appcompat-v7-23.1.0" level="project" />
<orderEntry type="library" exported="" name="okio-1.2.0" level="project" />
<orderEntry type="library" exported="" name="support-annotations-23.0.1" level="project" />
<orderEntry type="library" exported="" name="support-annotations-23.1.0" level="project" />
</component>
</module>
18 changes: 12 additions & 6 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ android {
minSdkVersion 16
targetSdkVersion 23
versionCode 1
versionName "1.0"
versionName "1.2"
}
buildTypes {
release {
Expand All @@ -18,21 +18,27 @@ android {
}
}

repositories {
mavenCentral()
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:support-v13:23.0.1'
compile 'com.android.support:support-v13:23.1.0'
compile 'fr.avianey.com.viewpagerindicator:library:2.4.1@aar'
compile 'com.android.support:design:23.0.1'
compile 'com.android.support:appcompat-v7:23.0.1'
compile 'com.android.support:cardview-v7:23.0.1'
compile 'com.android.support:design:23.1.0'
compile 'com.android.support:appcompat-v7:23.1.0'
compile 'com.android.support:cardview-v7:23.1.0'
compile 'com.squareup.retrofit:retrofit:1.9.0'
compile 'com.squareup.okhttp:okhttp:2.2.0'
compile 'com.android.support:recyclerview-v7:23.0.1'
compile 'com.android.support:recyclerview-v7:23.1.0'
compile 'com.ikimuhendis:ldrawer:0.1'
compile 'com.esotericsoftware.yamlbeans:yamlbeans:1.09'
compile "com.google.zxing:android-integration:3.2.0"
compile 'com.google.zxing:core:3.2.0'
compile "com.daimajia.swipelayout:library:1.1.8@aar"
compile 'de.hdodenhof:circleimageview:2.0.0'
compile 'com.michaelpardo:activeandroid:3.1.0-SNAPSHOT'

}
Binary file added android/app/shot/device-2015-10-26-153011.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added android/app/shot/device-2015-10-26-153054.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added android/app/shot/device-2015-10-26-162323.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added android/app/shot/device-2015-10-26-162333.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added android/app/shot/device-2015-10-26-162345.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added android/app/shot/device-2015-10-26-162356.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added android/app/shot/device-2015-10-26-162410.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 changes: 21 additions & 1 deletion android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,27 @@
<uses-permission android:name="android.permission.CHANGE_WIFI_MULTICAST_STATE" />
<uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" />
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<application
android:name=".MyApplication"
android:allowBackup="true"
android:icon="@mipmap/icon"
android:label="@string/app_name"
android:theme="@style/AppTheme" >

<meta-data
android:name="AA_DB_NAME"
android:value="PionOne.db" />
<meta-data
android:name="AA_DB_VERSION"
android:value="1" />


<meta-data
android:name="AA_MODELS"
android:value="cc.seeed.iot.webapi.model.Node, cc.seeed.iot.webapi.model.GroverDriver,
cc.seeed.iot.ui_setnode.model.PinConfig" />

<activity
android:name=".ui_main.MainScreenActivity"
android:theme="@style/Theme.DesignDemo" >
Expand Down Expand Up @@ -45,6 +60,11 @@
android:name="cc.seeed.iot.ui_smartconfig.SetNodeNameActivity"
android:theme="@style/Theme.NodeSet" >
</activity>
<activity
android:name="cc.seeed.iot.ui_ap_config.GoReadyActivity"
android:theme="@style/Theme.NodeSet" >

</activity>
<activity
android:name="cc.seeed.iot.ui_ap_config.WifiPionListActivity"
android:theme="@style/Theme.NodeSet" >
Expand Down Expand Up @@ -83,4 +103,4 @@
</activity>
</application>

</manifest>
</manifest>
93 changes: 53 additions & 40 deletions android/app/src/main/java/cc/seeed/iot/MyApplication.java
Original file line number Diff line number Diff line change
@@ -1,26 +1,20 @@
package cc.seeed.iot;

import android.app.Application;
import android.content.Context;
import android.content.SharedPreferences;

import java.util.ArrayList;

import cc.seeed.iot.datastruct.User;
import cc.seeed.iot.webapi.ExchangeApi;
import cc.seeed.iot.webapi.IotApi;
import cc.seeed.iot.webapi.model.Node;

/**
* Created by tenwong on 15/7/9.
*/
public class MyApplication extends Application {
public class MyApplication extends com.activeandroid.app.Application {
private SharedPreferences sp;

private ArrayList<Node> nodes = new ArrayList<Node>();

private User user = new User();

private String server_url;
private String ota_server_url;
private String exchange_server_url;

/**
* into smartconfig state
Expand All @@ -32,6 +26,30 @@ public class MyApplication extends Application {
*/
private Boolean loginState;

private Boolean firstUseState;


@Override
public void onCreate() {
super.onCreate();
sp = this.getSharedPreferences("IOT", Context.MODE_PRIVATE);
user.email = sp.getString("userName", "[email protected]");
user.user_key = sp.getString("userToken", "sBoKhjQNdtT8oTjukEeg98Ui3fuF3416zh-1Qm5Nkm0");
ota_server_url = sp.getString("ota_server_url", "https://iot.seeed.cc/v1"); //https://iot.seeed.cc/v1 //https://120.25.216.117/v1
exchange_server_url = sp.getString("exchange_server_url", "https://120.25.216.117/v1");
configState = sp.getBoolean("configState", false);
loginState = sp.getBoolean("loginState", false);
firstUseState = sp.getBoolean("firstUseState", true);

init();

}

private void init() {
IotApi.SetServerUrl(ota_server_url);
ExchangeApi.SetServerUrl(exchange_server_url);
}

public Boolean getLoginState() {
return loginState;
}
Expand All @@ -43,6 +61,17 @@ public void setLoginState(Boolean loginState) {
editor.apply();
}

public Boolean getFirstUseState() {
return firstUseState;
}

public void setFirstUseState(Boolean firstUseState) {
this.firstUseState = firstUseState;
SharedPreferences.Editor editor = sp.edit();
editor.putBoolean("firstUseState", firstUseState);
editor.apply();
}

public User getUser() {
return user;
}
Expand All @@ -55,22 +84,26 @@ public void setUser(User user) {
editor.apply();
}

public ArrayList<Node> getNodes() {
return nodes;
public String getServerUrl() {
return ota_server_url;
}

public void setNodes(ArrayList<Node> nodes) {
this.nodes = nodes;
public void setServerUrl(String server_url) {
this.ota_server_url = server_url;
IotApi.SetServerUrl(server_url);
SharedPreferences.Editor editor = sp.edit();
editor.putString("ota_server_url", server_url);
editor.apply();
}

public String getServer_url() {
return server_url;
public String getExchangeServerUrl() {
return exchange_server_url;
}

public void setServer_url(String server_url) {
this.server_url = server_url;
public void setExchangeServerUrl(String server_url) {
this.exchange_server_url = server_url;
SharedPreferences.Editor editor = sp.edit();
editor.putString("server_url", server_url);
editor.putString("exchange_server_url", server_url);
editor.apply();
}

Expand All @@ -85,24 +118,4 @@ public void setConfigState(Boolean configState) {
editor.apply();
}

@Override
public void onCreate() {
super.onCreate();
sp = this.getSharedPreferences("IOT", Context.MODE_PRIVATE);
sp.getString("serverAddress", "http://192.168.21.83:8080/v1");
user.email = sp.getString("userName", "[email protected]");
user.user_key = sp.getString("userToken", "sBoKhjQNdtT8oTjukEeg98Ui3fuF3416zh-1Qm5Nkm0");

server_url = sp.getString("server_url", "https://iot.seeed.cc/v1");

configState = sp.getBoolean("configState", false);

configState = sp.getBoolean("loginState", false);

init();
}

private void init() {
IotApi.SetServerUrl(server_url);
}
}
}
7 changes: 7 additions & 0 deletions android/app/src/main/java/cc/seeed/iot/datastruct/User.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,12 @@ public class User {
public String email;
public String user_key;
public String user_id;

public User() {
email = "";
user_key = "";
user_id = "";
}

}

Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import cc.seeed.iot.udp.ConfigUdpSocket;
import cc.seeed.iot.ui_main.MainScreenActivity;
import cc.seeed.iot.ui_smartconfig.GoReadyActivity;
import cc.seeed.iot.util.Common;
import cc.seeed.iot.webapi.IotApi;
import cc.seeed.iot.webapi.IotService;
import cc.seeed.iot.webapi.model.Node;
Expand Down Expand Up @@ -110,8 +111,12 @@ public void onClick(View v) {
return;
}
//APCFG: ssid\tpassword\tkey\tsn\t
// String cmd_connect = "APCFG: " + ssid + "\t" + password + "\t" +
// node_key + "\t" + node_sn + "\t";
String ota_server = ((MyApplication) getApplication()).getServerUrl().split("/")[2];
String exchange_server = ((MyApplication) getApplication()).getExchangeServerUrl().split("/")[2];
String cmd_connect = "APCFG: " + ssid + "\t" + password + "\t" +
node_key + "\t" + node_sn + "\t";
node_key + "\t" + node_sn + "\t" + ota_server + "\t" + exchange_server +"\t";

Log.i(TAG, "cmd_connect: " + cmd_connect);
Log.i(TAG, "ip: " + AP_IP);
Expand Down
Loading

0 comments on commit 1d9e602

Please sign in to comment.