Showing
5 changed files
with
26 additions
and
11 deletions
| @@ -12,7 +12,7 @@ import java.util.Hashtable; | @@ -12,7 +12,7 @@ import java.util.Hashtable; | ||
| 12 | /** | 12 | /** |
| 13 | * @author Ryan Tang | 13 | * @author Ryan Tang |
| 14 | */ | 14 | */ |
| 15 | -public final class QRCodeUitls { | 15 | +public final class QRCodeUtils { |
| 16 | private static final int BLACK = 0xff000000; | 16 | private static final int BLACK = 0xff000000; |
| 17 | 17 | ||
| 18 | public static Bitmap createQRCode(String str, int widthAndHeight) throws WriterException { | 18 | public static Bitmap createQRCode(String str, int widthAndHeight) throws WriterException { |
| @@ -59,12 +59,13 @@ public class SocketService extends Service { | @@ -59,12 +59,13 @@ public class SocketService extends Service { | ||
| 59 | private static final int ROOM_NOT_EXIST_M = 1002; | 59 | private static final int ROOM_NOT_EXIST_M = 1002; |
| 60 | private static final int HEAT_BEAT_RTN = 1003; | 60 | private static final int HEAT_BEAT_RTN = 1003; |
| 61 | 61 | ||
| 62 | -// public static final String HOST = "10.10.4.6";// "192.168.1.21";// | ||
| 63 | -// public static final int PORT = 9501; | 62 | +// develop |
| 63 | +// public static final String SERVER_HOST = "10.10.4.6";// "192.168.1.21";// | ||
| 64 | +// public static final int SERVER_PORT = 9501; | ||
| 64 | 65 | ||
| 65 | - public static final String HOST = "10.10.4.6";// "192.168.1.21";// | ||
| 66 | - public static final int PORT = 8899; | ||
| 67 | -// public static final int PORT = 9501; | 66 | +// test |
| 67 | + public static final String SERVER_HOST = "10.10.4.6";// "192.168.1.21";// | ||
| 68 | + public static final int SERVER_PORT = 8899; | ||
| 68 | 69 | ||
| 69 | public static final String END_SYMBOL = "\\r\\n\\r\\n";//心跳包内容 | 70 | public static final String END_SYMBOL = "\\r\\n\\r\\n";//心跳包内容 |
| 70 | // public String testRoomSn = "R170413034374"; | 71 | // public String testRoomSn = "R170413034374"; |
| @@ -168,7 +169,7 @@ public class SocketService extends Service { | @@ -168,7 +169,7 @@ public class SocketService extends Service { | ||
| 168 | } | 169 | } |
| 169 | 170 | ||
| 170 | private void initSocket() throws IOException {//初始化Socket | 171 | private void initSocket() throws IOException {//初始化Socket |
| 171 | - Socket so = new Socket(HOST, PORT); | 172 | + Socket so = new Socket(SERVER_HOST, SERVER_PORT); |
| 172 | mSocket = new WeakReference<Socket>(so); | 173 | mSocket = new WeakReference<Socket>(so); |
| 173 | mReadThread = new ReadThread(so); | 174 | mReadThread = new ReadThread(so); |
| 174 | mReadThread.start(); | 175 | mReadThread.start(); |
| @@ -1069,6 +1069,8 @@ public class MainActivity extends BaseActivity implements IMainView, EventListen | @@ -1069,6 +1069,8 @@ public class MainActivity extends BaseActivity implements IMainView, EventListen | ||
| 1069 | bleOpenRecord.setLockmac(lockMac); | 1069 | bleOpenRecord.setLockmac(lockMac); |
| 1070 | bleOpenRecord.setTime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.US).format(new Date())); | 1070 | bleOpenRecord.setTime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.US).format(new Date())); |
| 1071 | Intent intent = new Intent(); | 1071 | Intent intent = new Intent(); |
| 1072 | + | ||
| 1073 | + | ||
| 1072 | intent.setAction(GREENBluetoothLeService.ACTION_OPEN_SUCCESS); | 1074 | intent.setAction(GREENBluetoothLeService.ACTION_OPEN_SUCCESS); |
| 1073 | intent.putExtra("openrecord", bleOpenRecord); | 1075 | intent.putExtra("openrecord", bleOpenRecord); |
| 1074 | sendBroadcast(intent); | 1076 | sendBroadcast(intent); |
| @@ -2,10 +2,13 @@ package com.xgimi.gimicinema.activity; | @@ -2,10 +2,13 @@ package com.xgimi.gimicinema.activity; | ||
| 2 | 2 | ||
| 3 | import android.app.Activity; | 3 | import android.app.Activity; |
| 4 | import android.os.Bundle; | 4 | import android.os.Bundle; |
| 5 | +import android.os.Handler; | ||
| 5 | import android.widget.ImageView; | 6 | import android.widget.ImageView; |
| 6 | import com.gimi.common.cinema.model.MessageEvent; | 7 | import com.gimi.common.cinema.model.MessageEvent; |
| 7 | -import com.gimi.common.cinema.utils.QRCodeUitls; | 8 | +import com.gimi.common.cinema.utils.QRCodeUtils; |
| 9 | +import com.gimi.common.cinema.utils.SystemUtils; | ||
| 8 | import com.google.zxing.WriterException; | 10 | import com.google.zxing.WriterException; |
| 11 | +import com.qnbar.smc.utils.LightOperationUtils; | ||
| 9 | import com.xgimi.gimicinema.R; | 12 | import com.xgimi.gimicinema.R; |
| 10 | import org.greenrobot.eventbus.EventBus; | 13 | import org.greenrobot.eventbus.EventBus; |
| 11 | import org.greenrobot.eventbus.Subscribe; | 14 | import org.greenrobot.eventbus.Subscribe; |
| @@ -13,6 +16,7 @@ import org.greenrobot.eventbus.ThreadMode; | @@ -13,6 +16,7 @@ import org.greenrobot.eventbus.ThreadMode; | ||
| 13 | 16 | ||
| 14 | public class QrCodeShowActivity extends Activity { | 17 | public class QrCodeShowActivity extends Activity { |
| 15 | public static final int KILL_SELF = 0x9983; | 18 | public static final int KILL_SELF = 0x9983; |
| 19 | + private Handler handler = new Handler(); | ||
| 16 | 20 | ||
| 17 | @Override | 21 | @Override |
| 18 | protected void onCreate(Bundle savedInstanceState) { | 22 | protected void onCreate(Bundle savedInstanceState) { |
| @@ -23,10 +27,18 @@ public class QrCodeShowActivity extends Activity { | @@ -23,10 +27,18 @@ public class QrCodeShowActivity extends Activity { | ||
| 23 | final String qr = getIntent().getStringExtra("qr"); | 27 | final String qr = getIntent().getStringExtra("qr"); |
| 24 | ImageView iv = (ImageView) findViewById(R.id.qrCodeIv); | 28 | ImageView iv = (ImageView) findViewById(R.id.qrCodeIv); |
| 25 | try { | 29 | try { |
| 26 | - iv.setImageBitmap(QRCodeUitls.createQRCode(qr, 400)); | 30 | + iv.setImageBitmap(QRCodeUtils.createQRCode(qr, 400)); |
| 27 | } catch (WriterException e) { | 31 | } catch (WriterException e) { |
| 28 | e.printStackTrace(); | 32 | e.printStackTrace(); |
| 29 | } | 33 | } |
| 34 | + handler.postDelayed(new Runnable() { | ||
| 35 | + @Override | ||
| 36 | + public void run() { | ||
| 37 | + LightOperationUtils.close(); | ||
| 38 | + LightOperationUtils.setLightValue(5); | ||
| 39 | + new SystemUtils().closeFtLed(QrCodeShowActivity.this.getApplicationContext()); | ||
| 40 | + } | ||
| 41 | + }, 20 * 60 * 1000); | ||
| 30 | } | 42 | } |
| 31 | 43 | ||
| 32 | @Override | 44 | @Override |
| @@ -27,7 +27,7 @@ import com.gimi.common.cinema.model.SambaMsg; | @@ -27,7 +27,7 @@ import com.gimi.common.cinema.model.SambaMsg; | ||
| 27 | import com.gimi.common.cinema.model.UserInfo; | 27 | import com.gimi.common.cinema.model.UserInfo; |
| 28 | import com.gimi.common.cinema.utils.Des3; | 28 | import com.gimi.common.cinema.utils.Des3; |
| 29 | import com.gimi.common.cinema.utils.NetStatusUtils; | 29 | import com.gimi.common.cinema.utils.NetStatusUtils; |
| 30 | -import com.gimi.common.cinema.utils.QRCodeUitls; | 30 | +import com.gimi.common.cinema.utils.QRCodeUtils; |
| 31 | import com.gimi.common.cinema.utils.Utils; | 31 | import com.gimi.common.cinema.utils.Utils; |
| 32 | import com.google.gson.Gson; | 32 | import com.google.gson.Gson; |
| 33 | import com.xgimi.gimicinema.R; | 33 | import com.xgimi.gimicinema.R; |
| @@ -64,7 +64,7 @@ public class MainModelImpl implements IMainModel { | @@ -64,7 +64,7 @@ public class MainModelImpl implements IMainModel { | ||
| 64 | String msg = new Gson().toJson(userInfo); | 64 | String msg = new Gson().toJson(userInfo); |
| 65 | //sub thread ? | 65 | //sub thread ? |
| 66 | String decrypt = Des3.encode(msg); | 66 | String decrypt = Des3.encode(msg); |
| 67 | - Bitmap control = QRCodeUitls.create2DCode(decrypt); | 67 | + Bitmap control = QRCodeUtils.create2DCode(decrypt); |
| 68 | listener.onGetControlImageSuccess(control); | 68 | listener.onGetControlImageSuccess(control); |
| 69 | } catch (SocketException e) { | 69 | } catch (SocketException e) { |
| 70 | e.printStackTrace(); | 70 | e.printStackTrace(); |
Please
register
or
login
to post a comment