增加setInt

mada
Matthew 3 months ago
parent 4b9232f549
commit 8f5b5694c8

@ -18,6 +18,39 @@
#include "hdr.h" #include "hdr.h"
#define IOT_PARAM_WRITE 0xAE
#define IOT_PARAM_READ 0xAF
#define MAX_STRING_LEN 32
typedef struct
{
int cmd;
int value;
int result;
long value2;
char str[MAX_STRING_LEN];
}IOT_PARAM;
int setGpioInt(int cmd, int val)
{
int fd = open("/dev/mtkgpioctrl", O_RDONLY);
// LOGE("set_int fd=%d,cmd=%d,value=%d\r\n",fd, cmd, value);
if( fd > 0 )
{
IOT_PARAM param;
param.cmd = cmd;
param.value = val;
int res = ioctl(fd, IOT_PARAM_WRITE, &param);
// LOGE("set_int22 cmd=%d,value=%d,result=%d\r\n",param.cmd, param.value, param.result);
close(fd);
return 0;
}
return -1;
}
namespace cv2 namespace cv2
{ {
using namespace cv; using namespace cv;
@ -497,4 +530,11 @@ JNIEXPORT jboolean JNICALL
Java_com_xypower_mppreview_Camera2RawFragment_decodeDng(JNIEnv *env, jclass clazz, Java_com_xypower_mppreview_Camera2RawFragment_decodeDng(JNIEnv *env, jclass clazz,
jobject byte_buffer, jstring output_path) { jobject byte_buffer, jstring output_path) {
// TODO: implement decodeDng() // TODO: implement decodeDng()
}
extern "C"
JNIEXPORT void JNICALL
Java_com_xypower_mppreview_ui_CameraChannelActivity_setInt(JNIEnv *env, jclass clazz, jint cmd,
jint val) {
// TODO: implement setInt()
setGpioInt(cmd, val);
} }

@ -1,5 +1,7 @@
package com.xypower.mppreview.ui; package com.xypower.mppreview.ui;
import static java.lang.System.loadLibrary;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.app.AppCompatActivity;
import androidx.camera.core.CameraInfo; import androidx.camera.core.CameraInfo;
@ -33,12 +35,18 @@ import java.util.concurrent.Executors;
public class CameraChannelActivity extends AppCompatActivity implements View.OnClickListener { public class CameraChannelActivity extends AppCompatActivity implements View.OnClickListener {
static {
loadLibrary("mppreview");
}
private com.xypower.mppreview.databinding.ActivityCameraChannelBinding viewBinding; private com.xypower.mppreview.databinding.ActivityCameraChannelBinding viewBinding;
private int camerid; private int camerid;
private ImageCapture imageCapture; private ImageCapture imageCapture;
private ExecutorService cameraExecutor; private ExecutorService cameraExecutor;
private File outputDirectory; private File outputDirectory;
private static native void setInt(int cmd, int val);
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);

Loading…
Cancel
Save