完成TODO
This commit is contained in:
@@ -6,7 +6,7 @@
|
|||||||
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
|
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
|
||||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||||
<uses-permission android:name="android.permission.INTERNET" />
|
<uses-permission android:name="android.permission.INTERNET" />
|
||||||
<uses-permission android:name="android.permission.READ_LOGS" />
|
<uses-permission android:name="android.permission.READ_LOGS" tools:ignore="ProtectedPermissions"/>
|
||||||
<uses-permission android:name="android.permission.RECORD_AUDIO" />
|
<uses-permission android:name="android.permission.RECORD_AUDIO" />
|
||||||
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
|
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
|
||||||
<uses-permission android:name="android.permission.CAMERA" />
|
<uses-permission android:name="android.permission.CAMERA" />
|
||||||
@@ -17,7 +17,7 @@
|
|||||||
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
|
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
|
||||||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
|
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
|
||||||
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
|
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
|
||||||
<uses-permission android:name="android.permission.INSTALL_PACKAGES" />
|
<uses-permission android:name="android.permission.INSTALL_PACKAGES" tools:ignore="ProtectedPermissions"/>
|
||||||
<uses-permission android:name="android.permission.WAKE_LOCK" />
|
<uses-permission android:name="android.permission.WAKE_LOCK" />
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -290,12 +290,12 @@ public class MainActivity extends SDBaseActivity implements IVLCVout.OnNewVideoL
|
|||||||
*/
|
*/
|
||||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||||
public void loadFaceidInfo(QRCodeEvent qrCodeEvent) {
|
public void loadFaceidInfo(QRCodeEvent qrCodeEvent) {
|
||||||
if (qrCodeEvent.msg.equals("不是会员")){
|
if (qrCodeEvent.getMsg().equals("不是会员")){
|
||||||
// 这个是非会员进入现场
|
// 这个是非会员进入现场
|
||||||
this.showStrangerDialog();
|
this.showStrangerDialog();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
CrashReport.postCatchedException(new Throwable("接受到命令 " + qrCodeEvent.msg));
|
CrashReport.postCatchedException(new Throwable("接受到命令 " + qrCodeEvent.getMsg()));
|
||||||
// 监听到头像
|
// 监听到头像
|
||||||
Glide.with(this).load("https://www.baidu.com").into(this.avator_imageview);
|
Glide.with(this).load("https://www.baidu.com").into(this.avator_imageview);
|
||||||
user_name_label.setText("张三");
|
user_name_label.setText("张三");
|
||||||
@@ -303,13 +303,13 @@ public class MainActivity extends SDBaseActivity implements IVLCVout.OnNewVideoL
|
|||||||
user_amount_label.setText("amount");
|
user_amount_label.setText("amount");
|
||||||
unit_price_label.setText("price");
|
unit_price_label.setText("price");
|
||||||
welcome_label.setText(String.format("欢迎%s进场", "张三"));
|
welcome_label.setText(String.format("欢迎%s进场", "张三"));
|
||||||
if (TextUtils.isEmpty(qrCodeEvent.msg)) {
|
if (TextUtils.isEmpty(qrCodeEvent.getMsg())) {
|
||||||
memberInfoLineView.setVisibility(View.GONE);
|
memberInfoLineView.setVisibility(View.GONE);
|
||||||
memberInfopackLayout.setVisibility(View.GONE); // 场地的信息
|
memberInfopackLayout.setVisibility(View.GONE); // 场地的信息
|
||||||
} else {
|
} else {
|
||||||
memberInfoLineView.setVisibility(View.VISIBLE);
|
memberInfoLineView.setVisibility(View.VISIBLE);
|
||||||
memberInfopackLayout.setVisibility(View.VISIBLE);
|
memberInfopackLayout.setVisibility(View.VISIBLE);
|
||||||
this.user_place_label.setText(qrCodeEvent.msg);
|
this.user_place_label.setText(qrCodeEvent.getMsg());
|
||||||
}
|
}
|
||||||
|
|
||||||
int code = 1; // TODO 这个是获取事件的参数
|
int code = 1; // TODO 这个是获取事件的参数
|
||||||
|
|||||||
@@ -6,5 +6,27 @@ package com.ydd.sportfaceid.event;
|
|||||||
* @date 08/12/2017 11:16 PM
|
* @date 08/12/2017 11:16 PM
|
||||||
*/
|
*/
|
||||||
public class QRCodeEvent {
|
public class QRCodeEvent {
|
||||||
public String msg;
|
private int action;
|
||||||
|
private String msg;
|
||||||
|
|
||||||
|
public QRCodeEvent (int action,String msg){
|
||||||
|
this.action = action;
|
||||||
|
this.msg = msg;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getAction() {
|
||||||
|
return action;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAction(int action) {
|
||||||
|
this.action = action;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMsg() {
|
||||||
|
return msg;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMsg(String msg) {
|
||||||
|
this.msg = msg;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -59,19 +59,7 @@ public class ClientHandler extends SimpleChannelInboundHandler<String> {
|
|||||||
@Override
|
@Override
|
||||||
public void channelRead0(ChannelHandlerContext ctx, String msg) throws Exception {
|
public void channelRead0(ChannelHandlerContext ctx, String msg) throws Exception {
|
||||||
Log.d(TAG,"接收服务器响应msg:[" + msg + "]");
|
Log.d(TAG,"接收服务器响应msg:[" + msg + "]");
|
||||||
// 安卓写,非netty 后台实现
|
|
||||||
// TODO 安卓获取心跳内容(有二维码的唯一识别)显示请求小程序的venueId的二维码,无需拼接url
|
|
||||||
// TODO 安卓获取通知加载页面
|
|
||||||
// TODO 安卓获取通知开门失败消息 (进入一个页面,然后显示倒计时,回到主页(二维码页面))
|
|
||||||
// TODO 安卓获取通知开门的消息 (无需校验,直接操作开门)
|
|
||||||
MessageDTO message = JsonMapper.fromJson(msg, MessageDTO.class);
|
MessageDTO message = JsonMapper.fromJson(msg, MessageDTO.class);
|
||||||
switch (message.getMessageType()){
|
|
||||||
case LOAD:
|
|
||||||
System.out.println("LOADING" + message.getMessage());
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
System.out.println("default");
|
|
||||||
}
|
|
||||||
MessageService.getInstance().execute(message);
|
MessageService.getInstance().execute(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,6 +4,8 @@ package com.ydd.sportfaceid.service;
|
|||||||
import android.util.Base64;
|
import android.util.Base64;
|
||||||
|
|
||||||
import com.ydd.sportfaceid.BuildConfig;
|
import com.ydd.sportfaceid.BuildConfig;
|
||||||
|
import com.ydd.sportfaceid.event.MessageEvent;
|
||||||
|
import com.ydd.sportfaceid.event.QRCodeEvent;
|
||||||
import com.ydd.sportfaceid.netty.message.MessageDTO;
|
import com.ydd.sportfaceid.netty.message.MessageDTO;
|
||||||
import com.ydd.sportfaceid.utils.AppLogger;
|
import com.ydd.sportfaceid.utils.AppLogger;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
@@ -22,6 +24,7 @@ import okhttp3.Request;
|
|||||||
import okhttp3.RequestBody;
|
import okhttp3.RequestBody;
|
||||||
import okhttp3.Response;
|
import okhttp3.Response;
|
||||||
import okhttp3.ResponseBody;
|
import okhttp3.ResponseBody;
|
||||||
|
import org.greenrobot.eventbus.EventBus;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 消息服务
|
* 消息服务
|
||||||
@@ -54,55 +57,26 @@ public class MessageService {
|
|||||||
* @param message
|
* @param message
|
||||||
*/
|
*/
|
||||||
public void execute(MessageDTO message) {
|
public void execute(MessageDTO message) {
|
||||||
// if (null == message) {
|
switch (message.getMessageType()){
|
||||||
// return;
|
case LOAD:
|
||||||
// }
|
// TODO 安卓获取通知加载页面 (进入加载页面,显示欢迎用户的消息)
|
||||||
// Cmd cmd = Cmd.getCmd(message.getCmdId());
|
System.out.println("LOADING" + message.getMessage());
|
||||||
// switch (cmd) {
|
EventBus.getDefault().post(new QRCodeEvent(1,message.getMessage()));
|
||||||
// case HB:
|
break;
|
||||||
// break;
|
case OPENDOOR:
|
||||||
// case FACEID:
|
// TODO 安卓获取通知开门的消息 无需校验,直接操作开门
|
||||||
// EventBus.getDefault().post(new FaceidEvent(message.getResult()));
|
// 进入一个页面,然后显示倒计时,回到主页
|
||||||
// break;
|
EventBus.getDefault().post(new QRCodeEvent(2,message.getMessage()));
|
||||||
// //识别结果返回
|
System.out.println("OPENDOOR" + message.getMessage());
|
||||||
// case OPEN_DOOR:
|
break;
|
||||||
// AppLogger.getInstance().writeLog("----receive open door cmd----");
|
case FAILED:
|
||||||
// StartApplication.executor.execute(new Runnable() {
|
// TODO 安卓获取通知开门失败消息 进入一个页面,然后显示倒计时,回到主页
|
||||||
// @Override
|
EventBus.getDefault().post(new QRCodeEvent(3,message.getMessage()));
|
||||||
// public void run() {
|
System.out.println("FAILED" + message.getMessage());
|
||||||
// openDoor(message.getDoor());
|
break;
|
||||||
// }
|
default:
|
||||||
// });
|
System.out.println("default");
|
||||||
// break;
|
}
|
||||||
//
|
|
||||||
// //接收人脸照片
|
|
||||||
// case RECEV_FACE_IMAGE:
|
|
||||||
// //获取图片内容
|
|
||||||
// String imageBase64 = message.getContent();
|
|
||||||
// StartApplication.executor.execute(new Runnable() {
|
|
||||||
// @Override
|
|
||||||
// public void run() {
|
|
||||||
// try {
|
|
||||||
// Integer faceId = uploadFace(imageBase64);
|
|
||||||
// Message sendMsg = new Message();
|
|
||||||
// sendMsg.setCmdId(Cmd.RECEV_FACE_IMAGE_R.id);
|
|
||||||
// sendMsg.setDeviceId(DeviceIdUtil.generateDeviceId(StartApplication.getAppContext()));
|
|
||||||
// FaceImageDto faceImage = new FaceImageDto();
|
|
||||||
// faceImage.setFaceId(faceId);
|
|
||||||
// if (sendMsg.getFaceImage() != null) {
|
|
||||||
// faceImage.setMemberId(sendMsg.getFaceImage().getMemberId());
|
|
||||||
// }
|
|
||||||
// sendMsg.setFaceImage(faceImage);
|
|
||||||
// //返回上传结果
|
|
||||||
// ClientTcpSession.getInstance().send(sendMsg);
|
|
||||||
// } catch (Exception e) {
|
|
||||||
// Log.e(TAG, "upload face image error...");
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
// break;
|
|
||||||
// }
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user