VisitFace/DemoForBsk/app/src/main/java/cn/com/basic/face/discern/query/item/SurveillanceQueryItem.java
@@ -7,6 +7,8 @@ import android.net.Uri; import android.util.Base64; import cn.com.basic.face.util.NativeImg; public class SurveillanceQueryItem { // 人员主键 @@ -41,6 +43,8 @@ private Uri localUri; private boolean surveillancePhotoSelected; private NativeImg nativeImg; /** * Get 人员主键 @@ -216,4 +220,12 @@ public void setSurveillancePhotoSelected(boolean surveillancePhotoSelected) { this.surveillancePhotoSelected = surveillancePhotoSelected; } public NativeImg getNativeImg() { return nativeImg; } public void setNativeImg(NativeImg nativeImg) { this.nativeImg = nativeImg; } } VisitFace/DemoForBsk/app/src/main/java/cn/com/basic/face/fragment/DeviceFragment.java
@@ -1,5 +1,6 @@ package cn.com.basic.face.fragment; import android.os.Bundle; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentManager; import android.view.LayoutInflater; @@ -55,6 +56,11 @@ @ViewInject(R.id.fragment_left_right_frame_layout_right) private FrameLayout fragment_left_right_frame_layout_right; @ViewInject(R.id.fragment_device_right_camera1_brand) private EditText fragment_device_right_camera1_brand; @ViewInject(R.id.fragment_device_right_camera1_ip) private EditText fragment_device_right_camera1_ip; private View wifiView; private View lanView; private View schoolView; @@ -67,17 +73,28 @@ fragment_device_left_school_check_box.setChecked(false); fragment_device_left_camera1_check_box.setChecked(false); fragment_device_left_camera2_check_box.setChecked(false); fragment_left_right_frame_layout_right.removeAllViews(); } @Override protected void initViews(View view, Bundle savedInstanceState) { super.initViews(view, savedInstanceState); wifiView = LayoutInflater.from(getActivity()).inflate(R.layout.fragment_device_right_wifi, null); lanView = LayoutInflater.from(getActivity()).inflate(R.layout.fragment_device_right_lan, null); schoolView = LayoutInflater.from(getActivity()).inflate(R.layout.fragment_device_right_school, null); camera1View = LayoutInflater.from(getActivity()).inflate(R.layout.fragment_device_right_camera1, null); camera2View = LayoutInflater.from(getActivity()).inflate(R.layout.fragment_device_right_camera2, null); ViewUtils.inject(this, wifiView); ViewUtils.inject(this, lanView); ViewUtils.inject(this, schoolView); ViewUtils.inject(this, camera1View); ViewUtils.inject(this, camera2View); } @OnClick(R.id.fragment_device_left_wifi_check_box) public void fragment_device_left_wifi_check_box_click(View view) { clearAll(); fragment_device_left_wifi_check_box.setChecked(true); fragment_left_right_frame_layout_right.removeAllViews(); if (wifiView == null) { wifiView = LayoutInflater.from(getActivity()).inflate(R.layout.fragment_device_right_wifi, null); } fragment_left_right_frame_layout_right.addView(wifiView); } @@ -85,11 +102,6 @@ public void fragment_device_left_lan_check_box_click(View view) { clearAll(); fragment_device_left_lan_check_box.setChecked(true); fragment_left_right_frame_layout_right.removeAllViews(); if (lanView == null) { lanView = LayoutInflater.from(getActivity()).inflate(R.layout.fragment_device_right_lan, null); } fragment_left_right_frame_layout_right.addView(lanView); } @@ -97,11 +109,6 @@ public void fragment_device_left_school_check_box_click(View view) { clearAll(); fragment_device_left_school_check_box.setChecked(true); fragment_left_right_frame_layout_right.removeAllViews(); if (schoolView == null) { schoolView = LayoutInflater.from(getActivity()).inflate(R.layout.fragment_device_right_school, null); } fragment_left_right_frame_layout_right.addView(schoolView); } @@ -109,11 +116,6 @@ public void fragment_device_left_camera1_check_box_click(View view) { clearAll(); fragment_device_left_camera1_check_box.setChecked(true); fragment_left_right_frame_layout_right.removeAllViews(); if (camera1View == null) { camera1View = LayoutInflater.from(getActivity()).inflate(R.layout.fragment_device_right_camera1, null); } fragment_left_right_frame_layout_right.addView(camera1View); } @@ -121,11 +123,6 @@ public void fragment_device_left_camera2_check_box_click(View view) { clearAll(); fragment_device_left_camera2_check_box.setChecked(true); fragment_left_right_frame_layout_right.removeAllViews(); if (camera2View == null) { camera2View = LayoutInflater.from(getActivity()).inflate(R.layout.fragment_device_right_camera2, null); } fragment_left_right_frame_layout_right.addView(camera2View); } VisitFace/DemoForBsk/app/src/main/java/cn/com/basic/face/fragment/RegisterFragment.java
@@ -28,6 +28,7 @@ import cn.com.basic.face.service.RegisterMng; import cn.com.basic.face.service.SurveillanceMng; import cn.com.basic.face.util.Constant; import cn.com.basic.face.util.NativeImg; import cn.com.basic.face.util.OkClickedListener; import cn.com.basic.face.util.AppApi; @@ -43,6 +44,7 @@ import org.xutils.http.RequestParams; import java.io.ByteArrayOutputStream; import java.nio.ByteBuffer; import java.util.ArrayList; import java.util.Date; import java.util.List; @@ -114,6 +116,36 @@ @OnClick(R.id.fragment_register_add) public void fragment_register_add_click(View view) { // byte[] b = new byte[100]; // // List<NativeImg> faceImages = new ArrayList<>(); // NativeImg test = new NativeImg(); // test.height = 102; // test.width = 122; // test.image = new byte[49776]; // test.size = 49776; // faceImages.add(test); // // List<SurveillanceQueryItem> bitmapList = new ArrayList(); // for (int i = 0; i < faceImages.size(); i++) { // NativeImg item = faceImages.get(i); // SurveillanceQueryItem surveillanceQueryItem = new SurveillanceQueryItem(); // int offset = 0; // int size = item.size; // Bitmap bitmap = Bitmap.createBitmap(item.width,item.height, Bitmap.Config.ARGB_8888); // ByteBuffer byteBuffer = ByteBuffer.wrap(item.image, offset, size); // bitmap.copyPixelsFromBuffer(byteBuffer); // String str = Base64.encodeToString(item.image, offset, size, Base64.DEFAULT); // System.out.println(str.length()); // System.out.println(str); // byte[] b1 = Base64.decode(str, Base64.DEFAULT); // surveillanceQueryItem.setBase64Image(str); // surveillanceQueryItem.setBitmap(bitmap); // surveillanceQueryItem.setWidth(item.width+""); // surveillanceQueryItem.setHeight(item.height+""); // bitmapList.add(surveillanceQueryItem); // } // SurveillanceMng.getInstance().addBitmap(bitmapList, b, 100, 1+""); resetForm(); } @@ -207,7 +239,11 @@ params.addBodyParameter("width", surveillanceQueryItem.getWidth()); params.addBodyParameter("height", surveillanceQueryItem.getHeight()); fragment_register_surveillance_photo_img = surveillanceQueryItem.getBitmap(); params.addBodyParameter("base64Image", surveillanceQueryItem.getBase64Image()); NativeImg nativeImg = surveillanceQueryItem.getNativeImg(); String str = Base64.encodeToString(nativeImg.image, 0, nativeImg.size, Base64.DEFAULT); params.addBodyParameter("base64Image", str); } if (fragment_register_surveillance_photo_img != null) { @@ -238,6 +274,7 @@ } public void set_fragment_register_surveillance_photo(SurveillanceQueryItem item) { surveillanceQueryItem = item; fragment_register_surveillance_photo.setImageBitmap(item.getBitmap()); fragment_register_surveillance_photo_img = item.getBitmap(); fragment_register_surveillance_photo_placeholder_image.setVisibility(View.INVISIBLE); VisitFace/DemoForBsk/app/src/main/java/cn/com/basic/face/fragment/SurveillanceFragment.java
@@ -108,11 +108,11 @@ if (useNative) { MainActivity.getInstance().runOnUiThread(new Runnable() { public void run() { RtspFaceNative.setSurface(1, fragment_supervisory_enter_camera.getHolder().getSurface()); // RtspFaceNative.setSurface(1, fragment_supervisory_enter_camera.getHolder().getSurface()); RtspFaceNative.setSurface(2, fragment_supervisory_exit_camera.getHolder().getSurface()); RtspFaceNative.createPlayer(1, "rtsp://admin:admin12345@192.168.1.70:554/h264/ch1/sub/av_stream"); // RtspFaceNative.createPlayer(1, "rtsp://admin:admin12345@192.168.1.70:554/h264/ch1/sub/av_stream"); RtspFaceNative.createPlayer(2, "rtsp://admin:a1234567@192.168.1.68:554/h264/ch1/sub/av_stream"); RtspFaceNative.setFaceCallback(1, "cn/com/basic/face/util/RtspFaceNative", "faceCallBack"); // RtspFaceNative.setFaceCallback(1, "cn/com/basic/face/util/RtspFaceNative", "faceCallBack"); RtspFaceNative.setFaceCallback(2, "cn/com/basic/face/util/RtspFaceNative", "faceCallBack"); } }); VisitFace/DemoForBsk/app/src/main/java/cn/com/basic/face/service/SurveillanceMng.java
@@ -62,6 +62,7 @@ SurveillanceQueryItem surveillanceQueryItem = bitmapList.get(i); item.setBitmap(surveillanceQueryItem.getBitmap()); item.setBase64Image(surveillanceQueryItem.getBase64Image()); item.setNativeImg(surveillanceQueryItem.getNativeImg()); item.setWidth(surveillanceQueryItem.getWidth()); item.setHeight(surveillanceQueryItem.getHeight()); } @@ -72,6 +73,7 @@ SurveillanceQueryItem surveillanceQueryItem = bitmapList.get(i); item.setBitmap(surveillanceQueryItem.getBitmap()); item.setBase64Image(surveillanceQueryItem.getBase64Image()); item.setNativeImg(surveillanceQueryItem.getNativeImg()); item.setWidth(surveillanceQueryItem.getWidth()); item.setHeight(surveillanceQueryItem.getHeight()); } VisitFace/DemoForBsk/app/src/main/java/cn/com/basic/face/util/RtspFaceNative.java
@@ -115,6 +115,7 @@ } try{ List<SurveillanceQueryItem> bitmapList = new ArrayList(); for (int i = 0; i < faceImages.size(); i++) { NativeImg item = faceImages.get(i); @@ -124,7 +125,11 @@ Bitmap bitmap = Bitmap.createBitmap(item.width,item.height, Bitmap.Config.ARGB_8888); ByteBuffer byteBuffer = ByteBuffer.wrap(item.image, offset, size); bitmap.copyPixelsFromBuffer(byteBuffer); // surveillanceQueryItem.setBase64Image(Base64.encodeToString(item.image, offset, size, Base64.DEFAULT)); // String str = Base64.encodeToString(item.image, offset, size, Base64.DEFAULT); // System.out.println(str.length()); // System.out.println(str); // surveillanceQueryItem.setBase64Image(str); surveillanceQueryItem.setNativeImg(item); surveillanceQueryItem.setBitmap(bitmap); surveillanceQueryItem.setWidth(item.width+""); surveillanceQueryItem.setHeight(item.height+""); VisitFace/DemoForBsk/app/src/main/res/layout/fragment_device_right_camera1.xml
@@ -15,7 +15,37 @@ android:layout_height="@dimen/h76dp" android:gravity="right|center_vertical" android:orientation="horizontal"> <TextView android:id="@+id/fragment_device_right_delete" android:layout_width="@dimen/w40dp" android:layout_height="@dimen/h36dp" android:gravity="center" android:textColor="@android:color/white" android:background="@drawable/u194" android:text=""/> <TextView android:id="@+id/fragment_device_right_add" android:layout_width="@dimen/w40dp" android:layout_height="@dimen/h36dp" android:gravity="center" android:layout_marginLeft="@dimen/w10dp" android:textColor="@android:color/white" android:background="@drawable/u249" android:text=""/> <TextView android:id="@+id/fragment_device_right_save" android:layout_width="@dimen/w40dp" android:layout_height="@dimen/h36dp" android:gravity="center" android:layout_marginLeft="@dimen/w10dp" android:layout_marginRight="@dimen/w10dp" android:textColor="@android:color/white" android:background="@drawable/u208" android:text=""/> </LinearLayout> <ScrollView android:layout_width="match_parent" android:layout_height="wrap_content"> <LinearLayout android:orientation="vertical" android:layout_width="@dimen/w596dp" @@ -34,7 +64,7 @@ android:textSize="@dimen/w16dp" android:text="摄像机1" android:id="@+id/fragment_check_in_right_visitor_reason_text_view" android:layout_marginBottom="@dimen/h25dp" android:layout_marginBottom="@dimen/h20dp" /> <View android:layout_width="match_parent" @@ -51,13 +81,13 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:textStyle="bold" android:layout_marginTop="@dimen/h15dp" android:layout_marginTop="@dimen/h10dp" android:textSize="@dimen/w14dp" android:layout_marginBottom="@dimen/h6dp" android:text="摄像机品牌" /> <EditText android:id="@+id/fragment_check_in_right_visitor_reason" android:id="@+id/fragment_device_right_camera1_brand" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@null" @@ -82,12 +112,13 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:textStyle="bold" android:layout_marginTop="@dimen/h15dp" android:layout_marginTop="@dimen/h10dp" android:textSize="@dimen/w14dp" android:layout_marginBottom="@dimen/h6dp" android:text="IP" /> <EditText android:id="@+id/fragment_device_right_camera1_ip" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@null" @@ -112,7 +143,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:textStyle="bold" android:layout_marginTop="@dimen/h15dp" android:layout_marginTop="@dimen/h10dp" android:textSize="@dimen/w14dp" android:layout_marginBottom="@dimen/h6dp" android:text="端口" @@ -142,7 +173,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:textStyle="bold" android:layout_marginTop="@dimen/h15dp" android:layout_marginTop="@dimen/h10dp" android:textSize="@dimen/w14dp" android:layout_marginBottom="@dimen/h6dp" android:text="分辨率" @@ -172,7 +203,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:textStyle="bold" android:layout_marginTop="@dimen/h15dp" android:layout_marginTop="@dimen/h10dp" android:textSize="@dimen/w14dp" android:layout_marginBottom="@dimen/h6dp" android:text="用户名" @@ -202,7 +233,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:textStyle="bold" android:layout_marginTop="@dimen/h15dp" android:layout_marginTop="@dimen/h10dp" android:textSize="@dimen/w14dp" android:layout_marginBottom="@dimen/h6dp" android:text="密码" @@ -224,6 +255,7 @@ android:background="@color/colorText_b"/> </LinearLayout> </LinearLayout> </ScrollView> </LinearLayout> </ScrollView> </LinearLayout> VisitFace/DemoForBsk/app/src/main/res/layout/fragment_device_right_camera2.xml
@@ -15,6 +15,33 @@ android:layout_height="@dimen/h76dp" android:gravity="right|center_vertical" android:orientation="horizontal"> <TextView android:id="@+id/fragment_device_right_delete" android:layout_width="@dimen/w40dp" android:layout_height="@dimen/h36dp" android:gravity="center" android:textColor="@android:color/white" android:background="@drawable/u194" android:text=""/> <TextView android:id="@+id/fragment_device_right_add" android:layout_width="@dimen/w40dp" android:layout_height="@dimen/h36dp" android:gravity="center" android:layout_marginLeft="@dimen/w10dp" android:textColor="@android:color/white" android:background="@drawable/u249" android:text=""/> <TextView android:id="@+id/fragment_device_right_save" android:layout_width="@dimen/w40dp" android:layout_height="@dimen/h36dp" android:gravity="center" android:layout_marginLeft="@dimen/w10dp" android:layout_marginRight="@dimen/w10dp" android:textColor="@android:color/white" android:background="@drawable/u208" android:text=""/> </LinearLayout> <LinearLayout android:orientation="vertical" @@ -34,7 +61,7 @@ android:textSize="@dimen/w16dp" android:text="摄像机2" android:id="@+id/fragment_check_in_right_visitor_reason_text_view" android:layout_marginBottom="@dimen/h25dp" android:layout_marginBottom="@dimen/h20dp" /> <View android:layout_width="match_parent" @@ -51,7 +78,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:textStyle="bold" android:layout_marginTop="@dimen/h15dp" android:layout_marginTop="@dimen/h10dp" android:textSize="@dimen/w14dp" android:layout_marginBottom="@dimen/h6dp" android:text="摄像机品牌" @@ -82,7 +109,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:textStyle="bold" android:layout_marginTop="@dimen/h15dp" android:layout_marginTop="@dimen/h10dp" android:textSize="@dimen/w14dp" android:layout_marginBottom="@dimen/h6dp" android:text="IP" @@ -112,7 +139,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:textStyle="bold" android:layout_marginTop="@dimen/h15dp" android:layout_marginTop="@dimen/h10dp" android:textSize="@dimen/w14dp" android:layout_marginBottom="@dimen/h6dp" android:text="端口" @@ -142,7 +169,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:textStyle="bold" android:layout_marginTop="@dimen/h15dp" android:layout_marginTop="@dimen/h10dp" android:textSize="@dimen/w14dp" android:layout_marginBottom="@dimen/h6dp" android:text="分辨率" @@ -172,7 +199,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:textStyle="bold" android:layout_marginTop="@dimen/h15dp" android:layout_marginTop="@dimen/h10dp" android:textSize="@dimen/w14dp" android:layout_marginBottom="@dimen/h6dp" android:text="用户名" @@ -202,7 +229,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:textStyle="bold" android:layout_marginTop="@dimen/h15dp" android:layout_marginTop="@dimen/h10dp" android:textSize="@dimen/w14dp" android:layout_marginBottom="@dimen/h6dp" android:text="密码" VisitFace/DemoForBsk/app/src/main/res/layout/fragment_device_right_lan.xml
@@ -62,7 +62,7 @@ android:textSize="@dimen/w16dp" android:text="有线网络设置" android:id="@+id/fragment_check_in_right_visitor_reason_text_view" android:layout_marginBottom="@dimen/h25dp" android:layout_marginBottom="@dimen/h20dp" /> <View android:layout_width="match_parent" @@ -79,7 +79,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:textStyle="bold" android:layout_marginTop="@dimen/h15dp" android:layout_marginTop="@dimen/h10dp" android:textSize="@dimen/w14dp" android:layout_marginBottom="@dimen/h6dp" android:text="服务器IP" @@ -110,7 +110,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:textStyle="bold" android:layout_marginTop="@dimen/h15dp" android:layout_marginTop="@dimen/h10dp" android:textSize="@dimen/w14dp" android:layout_marginBottom="@dimen/h6dp" android:text="服务器端口" @@ -140,7 +140,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:textStyle="bold" android:layout_marginTop="@dimen/h15dp" android:layout_marginTop="@dimen/h10dp" android:textSize="@dimen/w14dp" android:layout_marginBottom="@dimen/h6dp" android:text="通讯" VisitFace/DemoForBsk/app/src/main/res/layout/fragment_device_right_school.xml
@@ -15,6 +15,33 @@ android:layout_height="@dimen/h76dp" android:gravity="right|center_vertical" android:orientation="horizontal"> <TextView android:id="@+id/fragment_device_right_delete" android:layout_width="@dimen/w40dp" android:layout_height="@dimen/h36dp" android:gravity="center" android:textColor="@android:color/white" android:background="@drawable/u194" android:text=""/> <TextView android:id="@+id/fragment_device_right_add" android:layout_width="@dimen/w40dp" android:layout_height="@dimen/h36dp" android:gravity="center" android:layout_marginLeft="@dimen/w10dp" android:textColor="@android:color/white" android:background="@drawable/u249" android:text=""/> <TextView android:id="@+id/fragment_device_right_save" android:layout_width="@dimen/w40dp" android:layout_height="@dimen/h36dp" android:gravity="center" android:layout_marginLeft="@dimen/w10dp" android:layout_marginRight="@dimen/w10dp" android:textColor="@android:color/white" android:background="@drawable/u208" android:text=""/> </LinearLayout> <LinearLayout android:orientation="vertical" @@ -35,7 +62,7 @@ android:textSize="@dimen/w16dp" android:text="所有学校设置" android:id="@+id/fragment_check_in_right_visitor_reason_text_view" android:layout_marginBottom="@dimen/h25dp" android:layout_marginBottom="@dimen/h20dp" /> <View android:layout_width="match_parent" @@ -52,7 +79,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:textStyle="bold" android:layout_marginTop="@dimen/h15dp" android:layout_marginTop="@dimen/h10dp" android:textSize="@dimen/w14dp" android:layout_marginBottom="@dimen/h6dp" android:text="学校名称" @@ -83,7 +110,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:textStyle="bold" android:layout_marginTop="@dimen/h15dp" android:layout_marginTop="@dimen/h10dp" android:textSize="@dimen/w14dp" android:layout_marginBottom="@dimen/h6dp" android:text="设备序列号" @@ -113,7 +140,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:textStyle="bold" android:layout_marginTop="@dimen/h15dp" android:layout_marginTop="@dimen/h10dp" android:textSize="@dimen/w14dp" android:layout_marginBottom="@dimen/h6dp" android:text="设备地点"