• 大小: 17KB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2021-06-05
  • 语言: Java
  • 标签: mstar  androi  

资源简介

mst Android按常规方法添加的native service在mst 方案上编译不到,这是在mst平台上调试触摸屏时实践有效的参考代码,多点触摸屏的native service参考代码。

资源截图

代码片段和文件信息

#define LOG_TAG         “SerialTouchScreenJNI“

#include 
#include “jni.h“
#include “JNIHelp.h“
#include “core_jni_helpers.h“

#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
//#include 

#include “utils/Log.h“

#include 


using namespace android;

TouchManager *tm;

static jfieldID field_context;


void com_mstar_android_tvapi_common_TouchPortManager_Setup(JNIEnv *env jobject thiz) {
    ALOGD(“native_setup“);
    tm = new TouchManager();
if(tm != NULL)
{
ALOGD(“native_setup success“);
//tm->TouchSetupCmd();
}
}

static jint com_mstar_android_tvapi_common_TouchPortManager_Read(JNIEnv *env jobject thiz jbyteArray data)
{
unsigned char *buf;
int num = 0;

buf =(unsigned char *)calloc(15sizeof(char));
if(buf == NULL)
{
  return 0;
}
//num = tm->TouchReadData(buf);

ALOGD(“android_cmds_SerialTouch_write“);

env->SetByteArrayRegion(data0num (jbyte*)buf);

free(buf);
return num;

}

static jint com_mstar_android_tvapi_common_TouchPortManager_EnableUsb(JNIEnv *env jobject thiz jboolean cmd)
{
int ret;

ALOGD(“android_cmds_SerialTouch_write“);
ret = tm->TouchEnableUsbTouch(cmd);
return ret;

}

static const char *classPathName = “com/mstar/android/tvapi/common/TouchPortManager“;

static JNINativeMethod methodtable[] = {
{ “native_setup“ “()V“(void*)com_mstar_android_tvapi_common_TouchPortManager_Setup}
{ “native_enableUsb“ “(Z)I“(void*)com_mstar_android_tvapi_common_TouchPortManager_EnableUsb}
{ “native_read“ “([B)I“(void*)com_mstar_android_tvapi_common_TouchPortManager_Read}
};

 
/*
int register_com_mstar_android_tvapi_common_TouchPortManager(JNIEnv *env)
{
    jclass clazz = FindClassOrDie(env classPathName);
    field_context = GetFieldIDOrDie(env clazz “mNativeContext“ “I“);

    return RegisterMethodsOrDie(env classPathName
            method_table NELEM(method_table));
}
*/
/*
 * Register several native methods for one class.
 */
static int registerNativeMethods(JNIEnv *env const char *className
                                 JNINativeMethod *gMethods int numMethods) {
    jclass clazz;

    clazz = env->FindClass(className);
    if (clazz == NULL) {
        ALOGE(“Native registration unable to find class ‘%s‘“ className);
        return JNI_FALSE;
    }
    if (env->RegisterNatives(clazz gMethods numMethods) < 0) {
        ALOGE(“RegisterNatives failed for ‘%s‘“ className);
        return JNI_FALSE;
    }

    return JNI_TRUE;
}

/*
 * Register native methods for all classes we know about.
 *
 * returns JNI_TRUE on success.
 */
static int registerNatives(JNIEnv *env) {
    if (!registerNativeMethods(env 

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件       3160  2018-12-14 09:59  SerialTouch\vendor\mstar\supernova\projects\tvos\tvos_makefile.diff

     文件        374  2018-12-13 15:06  SerialTouch\vendor\mstar\supernova\projects\tvos\include\SerialTouch\TouchManager.h

     文件       1234  2018-12-07 15:43  SerialTouch\vendor\mstar\supernova\projects\tvos\include\SerialTouch\ITouchManager.h

     文件       4503  2018-11-28 11:54  SerialTouch\vendor\mstar\supernova\projects\tvos\SerialTouch\Android.mk

     文件        780  2018-12-08 15:05  SerialTouch\vendor\mstar\supernova\projects\tvos\SerialTouch\test\Android.mk

     文件       1182  2018-12-08 15:57  SerialTouch\vendor\mstar\supernova\projects\tvos\SerialTouch\test\TouchClient_main.cpp

     文件        686  2018-12-08 11:46  SerialTouch\vendor\mstar\supernova\projects\tvos\SerialTouch\test\TouchService_main.cpp

     文件       5766  2018-12-07 16:27  SerialTouch\vendor\mstar\supernova\projects\tvos\SerialTouch\libtouchmanager\Android.mk

     文件       1703  2018-12-07 17:19  SerialTouch\vendor\mstar\supernova\projects\tvos\SerialTouch\libtouchmanager\ITouchManager.cpp

     文件       1142  2018-12-07 14:58  SerialTouch\vendor\mstar\supernova\projects\tvos\SerialTouch\libtouchmanager\Makefile

     文件       1696  2018-12-13 15:04  SerialTouch\vendor\mstar\supernova\projects\tvos\SerialTouch\libtouchmanager\TouchManager.cpp

     文件        686  2018-12-08 16:04  SerialTouch\vendor\mstar\supernova\projects\tvos\SerialTouch\libtouchmanager\TouchService_main.cpp

     文件       1120  2018-11-30 20:10  SerialTouch\vendor\mstar\supernova\projects\tvos\SerialTouch\Makefile

     文件        351  2018-12-08 15:03  SerialTouch\vendor\mstar\supernova\projects\tvos\SerialTouch\libtouchmanagerservice\Android.mk

     文件        957  2018-12-07 14:50  SerialTouch\vendor\mstar\supernova\projects\tvos\SerialTouch\libtouchmanagerservice\Makefile

     文件       9374  2018-12-08 16:29  SerialTouch\vendor\mstar\supernova\projects\tvos\SerialTouch\libtouchmanagerservice\TouchService.cpp

     文件       1336  2018-12-07 20:54  SerialTouch\vendor\mstar\supernova\projects\tvos\SerialTouch\libtouchmanagerservice\TouchService.h

     文件       3847  2018-12-07 16:26  SerialTouch\deviece\mstar\common\libraries\tvapi\jni\com_mstar_android_tvapi_common_TouchPortManager.cpp

     目录          0  2018-12-14 11:01  SerialTouch\vendor\mstar\supernova\projects\tvos\include\SerialTouch

     目录          0  2018-12-14 11:02  SerialTouch\vendor\mstar\supernova\projects\tvos\SerialTouch\test

     目录          0  2018-12-14 11:02  SerialTouch\vendor\mstar\supernova\projects\tvos\SerialTouch\libtouchmanager

     目录          0  2018-12-14 11:02  SerialTouch\vendor\mstar\supernova\projects\tvos\SerialTouch\libtouchmanagerservice

     目录          0  2018-12-14 11:01  SerialTouch\vendor\mstar\supernova\projects\tvos\include

     目录          0  2018-12-14 11:02  SerialTouch\vendor\mstar\supernova\projects\tvos\SerialTouch

     目录          0  2018-12-14 10:57  SerialTouch\deviece\mstar\common\libraries\tvapi\jni

     目录          0  2018-12-14 11:03  SerialTouch\vendor\mstar\supernova\projects\tvos

     目录          0  2018-12-14 10:55  SerialTouch\deviece\mstar\common\libraries\tvapi

     目录          0  2018-12-14 11:00  SerialTouch\vendor\mstar\supernova\projects

     目录          0  2018-12-14 10:55  SerialTouch\deviece\mstar\common\libraries

     目录          0  2018-12-14 11:00  SerialTouch\vendor\mstar\supernova

............此处省略9个文件信息

评论

共有 条评论