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