Объединить SETProtocol v2 и общие кодеки #1

Merged
Andrey merged 15 commits from codex/setprotocol-v2-all into master 2026-09-01 20:43:49 +03:00
2 changed files with 19 additions and 0 deletions
Showing only changes of commit 080b6900f5 - Show all commits

View File

@@ -18,6 +18,7 @@ object NativeProtoCan {
messageType: Int,
body: Int,
): Long
external fun nativeUnpackId(raw: Long): IntArray?
external fun nativeCrc16(input: ByteArray): Int
external fun nativeEncodeFrame(
sequence: Int,

View File

@@ -32,6 +32,24 @@ Java_ru_setcorp_setcore_NativeProtoCan_nativePackId(
(uint8_t)message_type, (uint16_t)body);
}
JNIEXPORT jintArray JNICALL
Java_ru_setcorp_setcore_NativeProtoCan_nativeUnpackId(
JNIEnv *env, jobject self, jlong raw)
{
(void)self;
uint8_t priority, route, device_type, device_id, message_type;
uint16_t body;
pcan_abi_id_unpack((uint32_t)raw, &priority, &route, &device_type,
&device_id, &message_type, &body);
jint values[6] = { (jint)priority, (jint)route, (jint)device_type,
(jint)device_id, (jint)message_type, (jint)body };
jintArray result = (*env)->NewIntArray(env, 6);
if (result != NULL) {
(*env)->SetIntArrayRegion(env, result, 0, 6, values);
}
return result;
}
JNIEXPORT jint JNICALL
Java_ru_setcorp_setcore_NativeProtoCan_nativeCrc16(
JNIEnv *env, jobject self, jbyteArray input)