18 | * Description: HTTP Response Callbacks 19 | *
20 | * Revision log:
21 | * 2017-07-01: created by strawmanbobi
22 | */
23 | public class WebAPICallbacks {
24 |
25 | public interface SignInCallback {
26 | void onSignInSuccess(UserApp userApp);
27 | void onSignInFailed();
28 | void onSignInError();
29 | }
30 |
31 | public interface ListCategoriesCallback {
32 | void onListCategoriesSuccess(List
10 | * Description: Status descriptor for air-conditioner
11 | *
12 | * Revision log:
13 | * 2017-03-28: created by strawmanbobi
14 | */
15 | public class ACStatus {
16 |
17 | public Constants.ACPower acPower;
18 | public Constants.ACTemperature acTemp;
19 | public Constants.ACMode acMode;
20 | public Constants.ACWindDirection acWindDir;
21 | public Constants.ACWindSpeed acWindSpeed;
22 | public Constants.ACSwing acSwing;
23 | public int acDisplay;
24 | public int acSleep;
25 | public int acTimer;
26 | }
27 |
--------------------------------------------------------------------------------
/web-api/src/main/java/net/irext/webapi/bean/TemperatureRange.java:
--------------------------------------------------------------------------------
1 | package net.irext.webapi.bean;
2 |
3 | /**
4 | * Filename: TemperatureRange.java
5 | * Revised: Date: 2017-03-28
6 | * Revision: Revision: 1.0
7 | *
8 | * Description: Temperature range for air-conditioner
9 | *
10 | * Revision log:
11 | * 2017-03-28: created by strawmanbobi
12 | */
13 | public class TemperatureRange {
14 |
15 | private static final String TAG = TemperatureRange.class.getSimpleName();
16 |
17 | private int tempMin;
18 | private int tempMax;
19 |
20 | public TemperatureRange() {
21 | }
22 |
23 | public TemperatureRange(int tempMin, int tempMax) {
24 | this.tempMin = tempMin;
25 | this.tempMax = tempMax;
26 | }
27 |
28 | public int getTempMin() {
29 | return tempMin;
30 | }
31 |
32 | public void setTempMin(int tempMin) {
33 | this.tempMin = tempMin;
34 | }
35 |
36 | public int getTempMax() {
37 | return tempMax;
38 | }
39 |
40 | public void setTempMax(int tempMax) {
41 | this.tempMax = tempMax;
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/web-api/src/main/java/net/irext/webapi/model/Brand.java:
--------------------------------------------------------------------------------
1 | package net.irext.webapi.model;
2 |
3 | /**
4 | * Filename: Brand.java
5 | * Revised: Date: 2017-03-28
6 | * Revision: Revision: 1.0
7 | *
8 | * Description: Brand bean
9 | *
10 | * Revision log:
11 | * 2017-03-28: created by strawmanbobi
12 | */
13 | public class Brand {
14 |
15 | private int id;
16 | private String name;
17 | private int categoryId;
18 | private String categoryName;
19 | private int status;
20 | private String updateTime;
21 | private int priority;
22 | private String nameEn;
23 | private String nameTw;
24 | private String contributor;
25 |
26 | public Brand(int id, String name, int categoryId, String categoryName, int status,
27 | String updateTime, int priority,
28 | String nameEn, String nameTw, String contributor) {
29 | this.id = id;
30 | this.name = name;
31 | this.categoryId = categoryId;
32 | this.categoryName = categoryName;
33 | this.status = status;
34 | this.updateTime = updateTime;
35 | this.priority = priority;
36 | this.nameEn = nameEn;
37 | this.nameTw = nameTw;
38 | this.contributor = contributor;
39 | }
40 |
41 | public Brand() {
42 |
43 | }
44 |
45 | public int getId() {
46 | return id;
47 | }
48 |
49 | public void setId(int id) {
50 | this.id = id;
51 | }
52 |
53 | public String getName() {
54 | return name;
55 | }
56 |
57 | public void setName(String name) {
58 | this.name = name;
59 | }
60 |
61 | public int getCategoryId() {
62 | return categoryId;
63 | }
64 |
65 | public void setCategoryId(int categoryId) {
66 | this.categoryId = categoryId;
67 | }
68 |
69 | public String getCategoryName() {
70 | return categoryName;
71 | }
72 |
73 | public void setCategoryName(String categoryName) {
74 | this.categoryName = categoryName;
75 | }
76 |
77 | public int getStatus() {
78 | return status;
79 | }
80 |
81 | public void setStatus(int status) {
82 | this.status = status;
83 | }
84 |
85 | public String getUpdateTime() {
86 | return updateTime;
87 | }
88 |
89 | public void setUpdateTime(String updateTime) {
90 | this.updateTime = updateTime;
91 | }
92 |
93 | public int getPriority() {
94 | return priority;
95 | }
96 |
97 | public void setPriority(int priority) {
98 | this.priority = priority;
99 | }
100 |
101 | public String getNameEn() {
102 | return nameEn;
103 | }
104 |
105 | public void setNameEn(String nameEn) {
106 | this.nameEn = nameEn;
107 | }
108 |
109 | public String getNameTw() {
110 | return nameTw;
111 | }
112 |
113 | public void setNameTw(String nameTw) {
114 | this.nameTw = nameTw;
115 | }
116 |
117 | public String getContributor() {
118 | return contributor;
119 | }
120 |
121 | public void setContributor(String contributor) {
122 | this.contributor = contributor;
123 | }
124 | }
125 |
--------------------------------------------------------------------------------
/web-api/src/main/java/net/irext/webapi/model/Category.java:
--------------------------------------------------------------------------------
1 | package net.irext.webapi.model;
2 |
3 | /**
4 | * Filename: Category.java
5 | * Revised: Date: 2017-03-28
6 | * Revision: Revision: 1.0
7 | *
8 | * Description: Category bean
9 | *
10 | * Revision log:
11 | * 2017-03-28: created by strawmanbobi
12 | */
13 | public class Category {
14 |
15 | private int id;
16 | private String name;
17 | private int status;
18 | private String updateTime;
19 | private String nameEn;
20 | private String nameTw;
21 | private String contributor;
22 |
23 | public Category(int id, String name, int status, String updateTime,
24 | String nameEn, String nameTw, String contributor) {
25 | this.id = id;
26 | this.name = name;
27 | this.status = status;
28 | this.updateTime = updateTime;
29 | this.nameEn = nameEn;
30 | this.nameTw = nameTw;
31 | this.contributor = contributor;
32 | }
33 |
34 | public Category() {
35 |
36 | }
37 |
38 | public int getId() {
39 | return id;
40 | }
41 |
42 | public void setId(int id) {
43 | this.id = id;
44 | }
45 |
46 | public String getName() {
47 | return name;
48 | }
49 |
50 | public void setName(String name) {
51 | this.name = name;
52 | }
53 |
54 | public int getStatus() {
55 | return status;
56 | }
57 |
58 | public void setStatus(int status) {
59 | this.status = status;
60 | }
61 |
62 | public String getUpdateTime() {
63 | return updateTime;
64 | }
65 |
66 | public void setUpdateTime(String updateTime) {
67 | this.updateTime = updateTime;
68 | }
69 |
70 | public String getNameEn() {
71 | return nameEn;
72 | }
73 |
74 | public void setNameEn(String nameEn) {
75 | this.nameEn = nameEn;
76 | }
77 |
78 | public String getNameTw() {
79 | return nameTw;
80 | }
81 |
82 | public void setNameTw(String nameTw) {
83 | this.nameTw = nameTw;
84 | }
85 |
86 | public String getContributor() {
87 | return contributor;
88 | }
89 |
90 | public void setContributor(String contributor) {
91 | this.contributor = contributor;
92 | }
93 | }
94 |
--------------------------------------------------------------------------------
/web-api/src/main/java/net/irext/webapi/model/City.java:
--------------------------------------------------------------------------------
1 | package net.irext.webapi.model;
2 |
3 | /**
4 | * Filename: City.java
5 | * Revised: Date: 2017-03-28
6 | * Revision: Revision: 1.0
7 | *
8 | * Description: City bean
9 | *
10 | * Revision log:
11 | * 2017-03-28: created by strawmanbobi
12 | */
13 | public class City {
14 |
15 | private int id;
16 | private String code;
17 | private String name;
18 | private double longitude;
19 | private double latitude;
20 | private int status;
21 | private String nameTw;
22 |
23 | public City(int id, String code, String name, double longitude, double latitude,
24 | int status, String nameTw) {
25 | this.id = id;
26 | this.code = code;
27 | this.name = name;
28 | this.longitude = longitude;
29 | this.latitude = latitude;
30 | this.status = status;
31 | this.nameTw = nameTw;
32 | }
33 |
34 | public City() {
35 |
36 | }
37 |
38 | public int getId() {
39 | return id;
40 | }
41 |
42 | public void setId(int id) {
43 | this.id = id;
44 | }
45 |
46 | public String getCode() {
47 | return code;
48 | }
49 |
50 | public void setCode(String code) {
51 | this.code = code;
52 | }
53 |
54 | public String getName() {
55 | return name;
56 | }
57 |
58 | public void setName(String name) {
59 | this.name = name;
60 | }
61 |
62 | public double getLongitude() {
63 | return longitude;
64 | }
65 |
66 | public void setLongitude(double longitude) {
67 | this.longitude = longitude;
68 | }
69 |
70 | public double getLatitude() {
71 | return latitude;
72 | }
73 |
74 | public void setLatitude(double latitude) {
75 | this.latitude = latitude;
76 | }
77 |
78 | public int getStatus() {
79 | return status;
80 | }
81 |
82 | public void setStatus(int status) {
83 | this.status = status;
84 | }
85 |
86 | public String getNameTw() {
87 | return nameTw;
88 | }
89 |
90 | public void setNameTw(String nameTw) {
91 | this.nameTw = nameTw;
92 | }
93 | }
94 |
--------------------------------------------------------------------------------
/web-api/src/main/java/net/irext/webapi/model/StbOperator.java:
--------------------------------------------------------------------------------
1 | package net.irext.webapi.model;
2 |
3 | /**
4 | * Filename: StbOperator.java
5 | * Revised: Date: 2017-03-28
6 | * Revision: Revision: 1.0
7 | *
8 | * Description: StbOperator bean
9 | *
10 | * Revision log:
11 | * 2017-03-28: created by strawmanbobi
12 | */
13 | public class StbOperator {
14 |
15 | private int id;
16 | private String operatorId;
17 | private String operatorName;
18 | private String cityCode;
19 | private String cityName;
20 | private int status;
21 | private String operatorNameTw;
22 |
23 | public StbOperator(int id, String operatorId, String operatorName,
24 | String cityCode, String cityName, int status, String operatorNameTw) {
25 | this.id = id;
26 | this.operatorId = operatorId;
27 | this.operatorName = operatorName;
28 | this.cityCode = cityCode;
29 | this.cityName = cityName;
30 | this.status = status;
31 | this.operatorNameTw = operatorNameTw;
32 | }
33 |
34 | public StbOperator() {
35 |
36 | }
37 |
38 | public int getId() {
39 | return id;
40 | }
41 |
42 | public void setId(int id) {
43 | this.id = id;
44 | }
45 |
46 | public String getOperatorId() {
47 | return operatorId;
48 | }
49 |
50 | public void setOperatorId(String operatorId) {
51 | this.operatorId = operatorId;
52 | }
53 |
54 | public String getOperatorName() {
55 | return operatorName;
56 | }
57 |
58 | public void setOperatorName(String operatorName) {
59 | this.operatorName = operatorName;
60 | }
61 |
62 | public String getCityCode() {
63 | return cityCode;
64 | }
65 |
66 | public void setCityCode(String cityCode) {
67 | this.cityCode = cityCode;
68 | }
69 |
70 | public String getCityName() {
71 | return cityName;
72 | }
73 |
74 | public void setCityName(String cityName) {
75 | this.cityName = cityName;
76 | }
77 |
78 | public int getStatus() {
79 | return status;
80 | }
81 |
82 | public void setStatus(int status) {
83 | this.status = status;
84 | }
85 |
86 | public String getOperatorNameTw() {
87 | return operatorNameTw;
88 | }
89 |
90 | public void setOperatorNameTw(String operatorNameTw) {
91 | this.operatorNameTw = operatorNameTw;
92 | }
93 | }
94 |
--------------------------------------------------------------------------------
/web-api/src/main/java/net/irext/webapi/request/AppSignInRequest.java:
--------------------------------------------------------------------------------
1 | package net.irext.webapi.request;
2 |
3 | /**
4 | * Filename: AppSignInRequest.java
5 | * Revised: Date: 2017-05-27
6 | * Revision: Revision: 1.0
7 | *
8 | * Description: HTTP admin login request
9 | *
10 | * Revision log:
11 | * 2017-05-27: created by strawmanbobi
12 | */
13 | public class AppSignInRequest extends BaseRequest {
14 |
15 | private String appKey;
16 | private String appSecret;
17 | private int appType;
18 | private String iOSID;
19 | private String androidPackageName;
20 | private String androidSignature;
21 |
22 | public AppSignInRequest(String appKey, String appSecret, int appType,
23 | String iOSID, String androidPackageName, String androidSignature) {
24 | this.appKey = appKey;
25 | this.appSecret = appSecret;
26 | this.appType = appType;
27 | this.iOSID = iOSID;
28 | this.androidPackageName = androidPackageName;
29 | this.androidSignature = androidSignature;
30 | }
31 |
32 | public AppSignInRequest() {
33 |
34 | }
35 |
36 | public String getAppKey() {
37 | return appKey;
38 | }
39 |
40 | public void setAppKey(String appKey) {
41 | this.appKey = appKey;
42 | }
43 |
44 | public String getAppSecret() {
45 | return appSecret;
46 | }
47 |
48 | public void setAppSecret(String appSecret) {
49 | this.appSecret = appSecret;
50 | }
51 |
52 | public int getAppType() {
53 | return appType;
54 | }
55 |
56 | public void setAppType(int appType) {
57 | this.appType = appType;
58 | }
59 |
60 | public String getiOSID() {
61 | return iOSID;
62 | }
63 |
64 | public void setiOSID(String iOSID) {
65 | this.iOSID = iOSID;
66 | }
67 |
68 | public String getAndroidPackageName() {
69 | return androidPackageName;
70 | }
71 |
72 | public void setAndroidPackageName(String androidPackageName) {
73 | this.androidPackageName = androidPackageName;
74 | }
75 |
76 | public String getAndroidSignature() {
77 | return androidSignature;
78 | }
79 |
80 | public void setAndroidSignature(String androidSignature) {
81 | this.androidSignature = androidSignature;
82 | }
83 | }
84 |
--------------------------------------------------------------------------------
/web-api/src/main/java/net/irext/webapi/request/BaseRequest.java:
--------------------------------------------------------------------------------
1 | package net.irext.webapi.request;
2 |
3 | import com.google.gson.Gson;
4 |
5 | /**
6 | * Filename: BaseRequest.java
7 | * Revised: Date: 2017-04-07
8 | * Revision: Revision: 1.0
9 | *
10 | * Description: authentication factors included
11 | *
12 | * Revision log:
13 | * 2017-04-07: created by strawmanbobi
14 | */
15 | public class BaseRequest {
16 |
17 | private int id;
18 | private String token;
19 |
20 | public BaseRequest(int id, String token) {
21 | this.id = id;
22 | this.token = token;
23 | }
24 |
25 | BaseRequest() {
26 |
27 | }
28 |
29 | public int getId() {
30 | return id;
31 | }
32 |
33 | public void setId(int id) {
34 | this.id = id;
35 | }
36 |
37 | public String getToken() {
38 | return token;
39 | }
40 |
41 | public void setToken(String token) {
42 | this.token = token;
43 | }
44 |
45 | public String toJson() {
46 | return new Gson().toJson(this, this.getClass());
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/web-api/src/main/java/net/irext/webapi/request/DecodeRequest.java:
--------------------------------------------------------------------------------
1 | package net.irext.webapi.request;
2 |
3 | import net.irext.webapi.bean.ACStatus;
4 |
5 | /**
6 | * Filename: DecodeRequest.java
7 | * Revised: Date: 2017-05-16
8 | * Revision: Revision: 1.0
9 | *
10 | * Description: HTTP decode online
11 | *
12 | * Revision log:
13 | * 2017-05-16: created by strawmanbobi
14 | */
15 | public class DecodeRequest extends BaseRequest {
16 |
17 | private int indexId;
18 | private ACStatus acStatus;
19 | private int keyCode;
20 | private int changeWindDir;
21 |
22 | public DecodeRequest(int indexId, ACStatus acStatus, int keyCode, int changeWindDir) {
23 | this.indexId = indexId;
24 | this.acStatus = acStatus;
25 | this.keyCode = keyCode;
26 | this.changeWindDir = changeWindDir;
27 | }
28 |
29 | public DecodeRequest() {
30 |
31 | }
32 |
33 | public int getIndexId() {
34 | return indexId;
35 | }
36 |
37 | public void setIndexId(int indexId) {
38 | this.indexId = indexId;
39 | }
40 |
41 | public ACStatus getAcStatus() {
42 | return acStatus;
43 | }
44 |
45 | public void setAcStatus(ACStatus acStatus) {
46 | this.acStatus = acStatus;
47 | }
48 |
49 | public int getKeyCode() {
50 | return keyCode;
51 | }
52 |
53 | public void setKeyCode(int keyCode) {
54 | this.keyCode = keyCode;
55 | }
56 |
57 | public int getChangeWindDir() {
58 | return changeWindDir;
59 | }
60 |
61 | public void setChangeWindDir(int changeWindDir) {
62 | this.changeWindDir = changeWindDir;
63 | }
64 | }
65 |
--------------------------------------------------------------------------------
/web-api/src/main/java/net/irext/webapi/request/DownloadBinaryRequest.java:
--------------------------------------------------------------------------------
1 | package net.irext.webapi.request;
2 |
3 | /**
4 | * Filename: DownloadBinaryRequest.java
5 | * Revised: Date: 2017-04-14
6 | * Revision: Revision: 1.0
7 | *
8 | * Description: HTTP download IR binary
9 | *
10 | * Revision log:
11 | * 2017-04-14: created by strawmanbobi
12 | */
13 | public class DownloadBinaryRequest extends BaseRequest {
14 |
15 | private int indexId;
16 |
17 | public DownloadBinaryRequest(int indexId) {
18 | this.indexId = indexId;
19 | }
20 |
21 | public DownloadBinaryRequest() {
22 |
23 | }
24 |
25 | public int getIndexId() {
26 | return indexId;
27 | }
28 |
29 | public void setIndexId(int indexId) {
30 | this.indexId = indexId;
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/web-api/src/main/java/net/irext/webapi/request/ListBrandsRequest.java:
--------------------------------------------------------------------------------
1 | package net.irext.webapi.request;
2 |
3 | /**
4 | * Filename: ListBrandsRequest.java
5 | * Revised: Date: 2017-04-07
6 | * Revision: Revision: 1.0
7 | *
8 | * Description: HTTP list brands request
9 | *
10 | * Revision log:
11 | * 2017-04-07: created by strawmanbobi
12 | */
13 | public class ListBrandsRequest extends BaseRequest {
14 |
15 | private int categoryId;
16 | private int from;
17 | private int count;
18 |
19 | public ListBrandsRequest(int categoryId, int from, int count) {
20 | this.categoryId = categoryId;
21 | this.from = from;
22 | this.count = count;
23 | }
24 |
25 | public ListBrandsRequest() {
26 |
27 | }
28 |
29 | public int getCategoryId() {
30 | return categoryId;
31 | }
32 |
33 | public void setCategoryId(int categoryId) {
34 | this.categoryId = categoryId;
35 | }
36 |
37 | public int getFrom() {
38 | return from;
39 | }
40 |
41 | public void setFrom(int from) {
42 | this.from = from;
43 | }
44 |
45 | public int getCount() {
46 | return count;
47 | }
48 |
49 | public void setCount(int count) {
50 | this.count = count;
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/web-api/src/main/java/net/irext/webapi/request/ListCategoriesRequest.java:
--------------------------------------------------------------------------------
1 | package net.irext.webapi.request;
2 |
3 | /**
4 | * Filename: ListCategoriesRequest.java
5 | * Revised: Date: 2017-04-07
6 | * Revision: Revision: 1.0
7 | *
8 | * Description: HTTP list categories request
9 | *
10 | * Revision log:
11 | * 2017-04-07: created by strawmanbobi
12 | */
13 | public class ListCategoriesRequest extends BaseRequest {
14 |
15 | private int from;
16 | private int count;
17 |
18 | public ListCategoriesRequest(int from, int count) {
19 | this.from = from;
20 | this.count = count;
21 | }
22 |
23 | public ListCategoriesRequest() {
24 |
25 | }
26 |
27 | public int getFrom() {
28 | return from;
29 | }
30 |
31 | public void setFrom(int from) {
32 | this.from = from;
33 | }
34 |
35 | public int getCount() {
36 | return count;
37 | }
38 |
39 | public void setCount(int count) {
40 | this.count = count;
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/web-api/src/main/java/net/irext/webapi/request/ListCitiesRequest.java:
--------------------------------------------------------------------------------
1 | package net.irext.webapi.request;
2 |
3 | /**
4 | * Filename: ListCitiesRequest.java
5 | * Revised: Date: 2017-04-07
6 | * Revision: Revision: 1.0
7 | *
8 | * Description: HTTP list cities request
9 | *
10 | * Revision log:
11 | * 2017-04-07: created by strawmanbobi
12 | */
13 | public class ListCitiesRequest extends BaseRequest {
14 |
15 | private String provincePrefix;
16 |
17 | public ListCitiesRequest(String provincePrefix) {
18 | this.provincePrefix = provincePrefix;
19 | }
20 |
21 | public ListCitiesRequest() {
22 |
23 | }
24 |
25 | public String getProvincePrefix() {
26 | return provincePrefix;
27 | }
28 |
29 | public void setProvincePrefix(String provincePrefix) {
30 | this.provincePrefix = provincePrefix;
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/web-api/src/main/java/net/irext/webapi/request/ListIndexesRequest.java:
--------------------------------------------------------------------------------
1 | package net.irext.webapi.request;
2 |
3 | /**
4 | * Filename: ListIndexesRequest.java
5 | * Revised: Date: 2017-04-12
6 | * Revision: Revision: 1.0
7 | *
8 | * Description: HTTP list remote indexes request
9 | *
10 | * Revision log:
11 | * 2017-04-12: created by strawmanbobi
12 | */
13 | public class ListIndexesRequest extends BaseRequest {
14 |
15 | private int from;
16 | private int count;
17 | private int categoryId;
18 | private int brandId;
19 | private String cityCode;
20 | private String operatorId;
21 |
22 | public ListIndexesRequest(int from, int count, int categoryId, int brandId,
23 | String cityCode, String operatorId) {
24 | this.from = from;
25 | this.count = count;
26 | this.categoryId = categoryId;
27 | this.brandId = brandId;
28 | this.cityCode = cityCode;
29 | this.operatorId = operatorId;
30 | }
31 |
32 | public ListIndexesRequest() {
33 |
34 | }
35 |
36 | public int getFrom() {
37 | return from;
38 | }
39 |
40 | public void setFrom(int from) {
41 | this.from = from;
42 | }
43 |
44 | public int getCount() {
45 | return count;
46 | }
47 |
48 | public void setCount(int count) {
49 | this.count = count;
50 | }
51 |
52 | public int getCategoryId() {
53 | return categoryId;
54 | }
55 |
56 | public void setCategoryId(int categoryId) {
57 | this.categoryId = categoryId;
58 | }
59 |
60 | public int getBrandId() {
61 | return brandId;
62 | }
63 |
64 | public void setBrandId(int brandId) {
65 | this.brandId = brandId;
66 | }
67 |
68 | public String getCityCode() {
69 | return cityCode;
70 | }
71 |
72 | public void setCityCode(String cityCode) {
73 | this.cityCode = cityCode;
74 | }
75 |
76 | public String getOperatorId() {
77 | return operatorId;
78 | }
79 |
80 | public void setOperatorId(String operatorId) {
81 | this.operatorId = operatorId;
82 | }
83 | }
84 |
--------------------------------------------------------------------------------
/web-api/src/main/java/net/irext/webapi/request/ListOperatorsRequest.java:
--------------------------------------------------------------------------------
1 | package net.irext.webapi.request;
2 |
3 | /**
4 | * Filename: ListOperatorsRequest.java
5 | * Revised: Date: 2017-04-10
6 | * Revision: Revision: 1.0
7 | *
8 | * Description: HTTP list STB operators request
9 | *
10 | * Revision log:
11 | * 2017-04-10: created by strawmanbobi
12 | */
13 | public class ListOperatorsRequest extends BaseRequest {
14 |
15 | private int from;
16 | private int count;
17 | private String cityCode;
18 |
19 | public ListOperatorsRequest(int from, int count, String cityCode) {
20 | this.from = from;
21 | this.count = count;
22 | this.cityCode = cityCode;
23 | }
24 |
25 | public ListOperatorsRequest() {
26 |
27 | }
28 |
29 | public int getFrom() {
30 | return from;
31 | }
32 |
33 | public void setFrom(int from) {
34 | this.from = from;
35 | }
36 |
37 | public int getCount() {
38 | return count;
39 | }
40 |
41 | public void setCount(int count) {
42 | this.count = count;
43 | }
44 |
45 | public String getCityCode() {
46 | return cityCode;
47 | }
48 |
49 | public void setCityCode(String cityCode) {
50 | this.cityCode = cityCode;
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/web-api/src/main/java/net/irext/webapi/response/BrandsResponse.java:
--------------------------------------------------------------------------------
1 | package net.irext.webapi.response;
2 |
3 | import net.irext.webapi.model.Brand;
4 |
5 | import java.util.List;
6 |
7 | /**
8 | * Filename: BrandsResponse.java
9 | * Revised: Date: 2017-04-07
10 | * Revision: Revision: 1.0
11 | *
12 | * Description: List brands response
13 | *
14 | * Revision log:
15 | * 2017-04-07: created by strawmanbobi
16 | */
17 | public class BrandsResponse extends ServiceResponse {
18 |
19 | private List
12 | * Description: List categories response
13 | *
14 | * Revision log:
15 | * 2017-04-07: created by strawmanbobi
16 | */
17 | public class CategoriesResponse extends ServiceResponse {
18 |
19 | private List
12 | * Description: List cities response
13 | *
14 | * Revision log:
15 | * 2017-04-07: created by strawmanbobi
16 | */
17 | public class CitiesResponse extends ServiceResponse {
18 |
19 | private List
8 | * Description: Online decode response
9 | *
10 | * Revision log:
11 | * 2017-05-16: created by strawmanbobi
12 | */
13 | public class DecodeResponse extends ServiceResponse {
14 |
15 | private int[] entity;
16 |
17 | public DecodeResponse(Status status, int[] entity) {
18 | super(status);
19 | this.entity = entity;
20 | }
21 |
22 | public DecodeResponse() {
23 |
24 | }
25 |
26 | public int[] getEntity() {
27 | return entity;
28 | }
29 |
30 | public void setEntity(int[] entity) {
31 | this.entity = entity;
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/web-api/src/main/java/net/irext/webapi/response/IndexesResponse.java:
--------------------------------------------------------------------------------
1 | package net.irext.webapi.response;
2 |
3 | import net.irext.webapi.model.RemoteIndex;
4 |
5 | import java.util.List;
6 |
7 | /**
8 | * Filename: IndexesResponse.java
9 | * Revised: Date: 2017-04-12
10 | * Revision: Revision: 1.0
11 | *
12 | * Description: List remote indexes response
13 | *
14 | * Revision log:
15 | * 2017-04-12: created by strawmanbobi
16 | */
17 | public class IndexesResponse extends ServiceResponse {
18 |
19 | private List
9 | * Description: HTTP Admin login response
10 | *
11 | * Revision log:
12 | * 2017-03-31: created by strawmanbobi
13 | */
14 | public class LoginResponse extends ServiceResponse {
15 |
16 | private UserApp entity;
17 |
18 | public LoginResponse(Status status, UserApp userApp) {
19 | super(status);
20 | this.entity = userApp;
21 | }
22 |
23 | public LoginResponse() {
24 |
25 | }
26 |
27 | public UserApp getEntity() {
28 | return entity;
29 | }
30 |
31 | public void setEntity(UserApp entity) {
32 | this.entity = entity;
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/web-api/src/main/java/net/irext/webapi/response/OperatorsResponse.java:
--------------------------------------------------------------------------------
1 | package net.irext.webapi.response;
2 |
3 | import net.irext.webapi.model.StbOperator;
4 |
5 | import java.util.List;
6 |
7 | /**
8 | * Filename: OperatorsResponse.java
9 | * Revised: Date: 2017-04-10
10 | * Revision: Revision: 1.0
11 | *
12 | * Description: List STB operators response
13 | *
14 | * Revision log:
15 | * 2017-04-10: created by strawmanbobi
16 | */
17 | public class OperatorsResponse extends ServiceResponse {
18 |
19 | private List
8 | * Description: HTTP Response base class
9 | *
10 | * Revision log:
11 | * 2017-03-31: created by strawmanbobi
12 | */
13 | public class ServiceResponse {
14 |
15 | private Status status;
16 |
17 | public ServiceResponse(Status status) {
18 | this.status = status;
19 | }
20 |
21 | public ServiceResponse() {
22 |
23 | }
24 |
25 | public Status getStatus() {
26 | return status;
27 | }
28 |
29 | public void setStatus(Status status) {
30 | this.status = status;
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/web-api/src/main/java/net/irext/webapi/response/Status.java:
--------------------------------------------------------------------------------
1 | package net.irext.webapi.response;
2 |
3 | /**
4 | * Filename: Status.java
5 | * Revised: Date: 2017-03-31
6 | * Revision: Revision: 1.0
7 | *
8 | * Description: HTTP response status
9 | *
10 | * Revision log:
11 | * 2017-03-31: created by strawmanbobi
12 | */
13 | public class Status {
14 |
15 | private int code;
16 | private String cause;
17 |
18 | public Status(int code, String cause) {
19 | this.code = code;
20 | this.cause = cause;
21 | }
22 |
23 | public Status() {
24 |
25 | }
26 |
27 | public int getCode() {
28 | return code;
29 | }
30 |
31 | public void setCode(int code) {
32 | this.code = code;
33 | }
34 |
35 | public String getCause() {
36 | return cause;
37 | }
38 |
39 | public void setCause(String cause) {
40 | this.cause = cause;
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/web-api/src/main/java/net/irext/webapi/utils/Constants.java:
--------------------------------------------------------------------------------
1 | package net.irext.webapi.utils;
2 |
3 | /**
4 | * Filename: Constants.java
5 | * Revised: Date: 2017-04-03
6 | * Revision: Revision: 1.0
7 | *
8 | * Description: SDK Constants
9 | *
10 | * Revision log:
11 | * 2017-04-03: created by strawmanbobi
12 | */
13 | public class Constants {
14 |
15 | public static final int ERROR_CODE_SUCCESS = 0;
16 | public static final int ERROR_CODE_NETWORK_ERROR = -1;
17 | public static final int ERROR_CODE_AUTH_FAILURE = 1;
18 | public static final int ERROR_CODE_INVALID_CATEGORY = 2;
19 | public static final int ERROR_CODE_INVALID_BRAND = 3;
20 | public static final int ERROR_CODE_INVALID_PARAMETER = 4;
21 |
22 |
23 | public enum ContentID {
24 | LIST_CATEGORIES(0),
25 | LIST_BRANDS(1),
26 | LIST_PROVINCES(2),
27 | LIST_CITIES(3),
28 | LIST_OPERATORS(4),
29 | LIST_INDEXES(5);
30 |
31 | private final int id;
32 |
33 | ContentID(int id) {
34 | this.id = id;
35 | }
36 |
37 | public int getValue() { return id; }
38 | }
39 |
40 | public enum CategoryID {
41 | AIR_CONDITIONER(1),
42 | TV(2),
43 | STB(3),
44 | NET_BOX(4),
45 | IPTV(5),
46 | DVD(6),
47 | FAN(7),
48 | PROJECTOR(8),
49 | STEREO(9),
50 | LIGHT(10),
51 | BSTB(11),
52 | CLEANING_ROBOT(12),
53 | AIR_CLEANER(13),
54 | DYSON(14),
55 | DIY(15);
56 | private final int id;
57 |
58 | CategoryID(int id) {
59 | this.id = id;
60 | }
61 |
62 | public int getValue() {
63 | return id;
64 | }
65 | }
66 |
67 | public enum BinaryType {
68 | TYPE_BINARY(0),
69 | TYPE_HEXDECIMAL(1);
70 |
71 | private final int type;
72 |
73 | BinaryType(int type) {
74 | this.type = type;
75 | }
76 |
77 | public int getValue() {
78 | return type;
79 | }
80 | }
81 |
82 | public enum ACPower {
83 | POWER_ON(0),
84 | POWER_OFF(1);
85 |
86 | private final int power;
87 |
88 | ACPower(int power) {
89 | this.power = power;
90 | }
91 |
92 | public int getValue() {
93 | return power;
94 | }
95 | }
96 |
97 | public enum ACMode {
98 | MODE_COOL(0),
99 | MODE_HEAT(1),
100 | MODE_AUTO(2),
101 | MODE_FAN(3),
102 | MODE_DEHUMIDITY(4);
103 |
104 | private final int mode;
105 |
106 | ACMode(int mode) {
107 | this.mode = mode;
108 | }
109 |
110 | public int getValue() {
111 | return mode;
112 | }
113 | }
114 |
115 | public enum ACWindDirection {
116 | DIR_TOP(0),
117 | DIR_MIDDLE(1),
118 | DIR_BOTTOM(2);
119 |
120 | private final int direction;
121 |
122 | ACWindDirection(int i) {
123 | direction = i;
124 | }
125 |
126 | public int getValue() { return direction; }
127 |
128 |
129 | }
130 |
131 | public enum ACTemperature {
132 | TEMP_16(0),
133 | TEMP_17(1),
134 | TEMP_18(2),
135 | TEMP_19(3),
136 | TEMP_20(4),
137 | TEMP_21(5),
138 | TEMP_22(6),
139 | TEMP_23(7),
140 | TEMP_24(8),
141 | TEMP_25(9),
142 | TEMP_26(10),
143 | TEMP_27(11),
144 | TEMP_28(12),
145 | TEMP_29(13),
146 | TEMP_30(14);
147 |
148 | private final int temp;
149 |
150 | ACTemperature(int temp) {
151 | this.temp = temp;
152 | }
153 |
154 | public int getValue() {
155 | return temp;
156 | }
157 | }
158 |
159 | public enum ACWindSpeed {
160 | SPEED_AUTO(0),
161 | SPEED_LOW(1),
162 | SPEED_MEDIUM(2),
163 | SPEED_HIGH(3);
164 |
165 | private final int speed;
166 |
167 | ACWindSpeed(int speed) {
168 | this.speed = speed;
169 | }
170 |
171 | public int getValue() {
172 | return speed;
173 | }
174 | }
175 |
176 | public enum ACSwing {
177 | SWING_ON(0),
178 | SWING_OFF(1);
179 |
180 | private final int swing;
181 |
182 | ACSwing(int swing) {
183 | this.swing = swing;
184 | }
185 |
186 | public int getValue() {
187 | return swing;
188 | }
189 | }
190 |
191 | public enum ACFunction {
192 | FUNCTION_SWITCH_POWER(1),
193 | FUNCTION_CHANGE_MODE(2),
194 | FUNCTION_TEMPERATURE_UP(3),
195 | FUNCTION_TEMPERATURE_DOWN(4),
196 | FUNCTION_SWITCH_WIND_SPEED(5),
197 | FUNCTION_SWITCH_WIND_DIR(6),
198 | FUNCTION_SWITCH_SWING(7);
199 |
200 | private final int function;
201 |
202 | ACFunction(int function) {
203 | this.function = function;
204 | }
205 |
206 | public int getValue() {
207 | return function;
208 | }
209 | }
210 | }
211 |
--------------------------------------------------------------------------------
/web-api/src/main/java/net/irext/webapi/utils/MD5Digest.java:
--------------------------------------------------------------------------------
1 | package net.irext.webapi.utils;
2 |
3 | import java.security.MessageDigest;
4 |
5 | /**
6 | * Filename: MD5Digest.java
7 | * Revised: Date: 2017-04-03
8 | * Revision: Revision: 1.0
9 | *
10 | * Description: MD5 digest algorithm
11 | *
12 | * Revision log:
13 | * 2017-04-03: created by strawmanbobi
14 | */
15 | public class MD5Digest {
16 |
17 | public static String MD5(String content) {
18 | String result = null;
19 | try {
20 | MessageDigest md = MessageDigest.getInstance("MD5");
21 | md.update(content.getBytes());
22 | byte b[] = md.digest();
23 |
24 | int i;
25 |
26 | StringBuffer buf = new StringBuffer("");
27 | for (int offset = 0; offset < b.length; offset++) {
28 | i = b[offset];
29 | if (i < 0) i += 256;
30 | if (i < 16) buf.append("0");
31 | buf.append(Integer.toHexString(i));
32 | }
33 | result = buf.toString();
34 | } catch (Exception e) {
35 | e.printStackTrace();
36 | return content;
37 | }
38 | return result;
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/web-api/src/main/java/net/irext/webapi/utils/PackageUtils.java:
--------------------------------------------------------------------------------
1 | package net.irext.webapi.utils;
2 |
3 | import android.content.Context;
4 | import android.content.pm.PackageInfo;
5 | import android.content.pm.PackageManager;
6 | import android.content.pm.Signature;
7 |
8 | import java.io.ByteArrayInputStream;
9 | import java.io.InputStream;
10 | import java.security.MessageDigest;
11 | import java.security.NoSuchAlgorithmException;
12 | import java.security.cert.CertificateEncodingException;
13 | import java.security.cert.CertificateException;
14 | import java.security.cert.CertificateFactory;
15 | import java.security.cert.X509Certificate;
16 |
17 | /**
18 | * Filename: PackageUtils.java
19 | * Revised: Date: 2017-05-27
20 | * Revision: Revision: 1.0
21 | *
22 | * Description: String utils
23 | *
24 | * Revision log:
25 | * 2017-05-27: created by strawmanbobi
26 | */
27 | public class PackageUtils {
28 |
29 | public static String byte2HexFormatted(byte[] arr) {
30 | StringBuilder str = new StringBuilder(arr.length * 2);
31 | for (int i = 0; i < arr.length; i++) {
32 | String h = Integer.toHexString(arr[i]);
33 | int l = h.length();
34 | if (l == 1) h = "0" + h;
35 | if (l > 2) h = h.substring(l - 2, l);
36 | str.append(h.toUpperCase());
37 | if (i < (arr.length - 1)) str.append(':');
38 | }
39 | return str.toString();
40 | }
41 |
42 | public static String getCertificateSHA1Fingerprint(Context context) {
43 | PackageManager pm = context.getPackageManager();
44 | String packageName = context.getPackageName();
45 | int flags = PackageManager.GET_SIGNATURES;
46 | PackageInfo packageInfo = null;
47 | try {
48 | packageInfo = pm.getPackageInfo(packageName, flags);
49 | } catch (PackageManager.NameNotFoundException e) {
50 | e.printStackTrace();
51 | }
52 | Signature[] signatures = packageInfo.signatures;
53 | byte[] cert = signatures[0].toByteArray();
54 | InputStream input = new ByteArrayInputStream(cert);
55 | CertificateFactory cf = null;
56 | try {
57 | cf = CertificateFactory.getInstance("X509");
58 | } catch (CertificateException e) {
59 | e.printStackTrace();
60 | }
61 | X509Certificate c = null;
62 | try {
63 | c = (X509Certificate) cf.generateCertificate(input);
64 | } catch (CertificateException e) {
65 | e.printStackTrace();
66 | }
67 | String hexString = null;
68 | try {
69 | MessageDigest md = MessageDigest.getInstance("SHA1");
70 | byte[] publicKey = md.digest(c.getEncoded());
71 | hexString = byte2HexFormatted(publicKey);
72 | } catch (NoSuchAlgorithmException e1) {
73 | e1.printStackTrace();
74 | } catch (CertificateEncodingException e) {
75 | e.printStackTrace();
76 | }
77 | return hexString;
78 | }
79 | }
80 |
--------------------------------------------------------------------------------