File tree Expand file tree Collapse file tree
icarbonx/smartdevice/account
test/java/com/demo/icarbox/blereceiver_test Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -53,10 +53,14 @@ dependencies {
5353 implementation fileTree(include : [' *.jar' ], dir : ' libs' )
5454 annotationProcessor deps. arouter_compiler
5555 implementation project(' :lib_common' )
56- api ' com.marshalchen.ultimaterecyclerview:library:0.7.3'
5756 // Log Bluetooth LE events in nRF Logger
5857 implementation ' no.nordicsemi.android:log:2.1.1'
5958 // BLE library
60- // implementation 'no.nordicsemi.android:ble:1.1.0'
59+ // implementation 'no.nordicsemi.android:ble:1.1.0'
6160 implementation project(' :ble' )
61+ implementation ' joda-time:joda-time:2.3'
62+
63+ testImplementation ' junit:junit:4.12'
64+ // androidTestImplementation 'com.android.support.test:runner:1.0.2'
65+ // androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
6266}
Original file line number Diff line number Diff line change 11package com .demo .icarbox .blereceiver ;
22
3+ import android .accounts .Account ;
34import android .bluetooth .BluetoothAdapter ;
45import android .bluetooth .BluetoothDevice ;
56import android .content .BroadcastReceiver ;
@@ -99,6 +100,7 @@ protected void onResume() {
99100
100101 LocalBroadcastManager .getInstance (getApplicationContext ())
101102 .registerReceiver (broadcastReceiver , intentFilter );
103+
102104 }
103105
104106 @ Override
Original file line number Diff line number Diff line change 1+ package com .icarbonx .smartdevice .account ;
2+
3+ /**
4+ * Base account to decide common proterties
5+ */
6+ public class Account implements JsonInterface {
7+
8+ @ Override
9+ public String toJson () {
10+ return "{}" ;
11+ }
12+ }
Original file line number Diff line number Diff line change 1+ package com .icarbonx .smartdevice .account ;
2+
3+ import com .google .gson .Gson ;
4+
5+ import org .joda .time .DateTime ;
6+ import org .joda .time .LocalDate ;
7+
8+ /**
9+ * Base response class for user account controller
10+ * @author lavi
11+ */
12+ public class BaseResp <T > implements JsonInterface {
13+ T data ;
14+
15+ //error message
16+ String errMsg ;
17+ //error code
18+ int errorCode ;
19+ //current pasge index
20+ int pageIndex ;
21+ //current page size
22+ int pageSize ;
23+ //time stamp for the response
24+ long timestamp ;
25+ //total number
26+ int totalNum ;
27+ //total page count
28+ int totalPage ;
29+
30+ public T getData () {
31+ return data ;
32+ }
33+
34+ public BaseResp <T > setData (T data ) {
35+ this .data = data ;
36+ return this ;
37+ }
38+
39+ public String getErrMsg () {
40+ return errMsg ;
41+ }
42+
43+ public int getErrorCode () {
44+ return errorCode ;
45+ }
46+
47+ public int getPageIndex () {
48+ return pageIndex ;
49+ }
50+
51+ public int getPageSize () {
52+ return pageSize ;
53+ }
54+
55+ public long getTimestamp () {
56+ return timestamp ;
57+ }
58+
59+ public int getTotalNum () {
60+ return totalNum ;
61+ }
62+
63+ public int getTotalPage () {
64+ return totalPage ;
65+ }
66+
67+ @ Override
68+ public String toString () {
69+ return toJson ();
70+ }
71+
72+ @ Override
73+ public String toJson () {
74+ return new Gson ().toJson (this );
75+ }
76+ }
Original file line number Diff line number Diff line change 1+ package com .icarbonx .smartdevice .account ;
2+
3+ /**
4+ * Convert class to json string.
5+ */
6+ public interface JsonInterface {
7+ String toJson ();
8+ }
You can’t perform that action at this time.
0 commit comments