26#include "jau_direct_bt_DBTGattDesc.h"
44 if(
nullptr != sref.
pointer() ) {
45 std::shared_ptr<BTGattDesc>* sref_ptr = castInstance<BTGattDesc>(nativeInstance);
57 JavaAnonRef descriptor_java = descriptor->getJavaObject();
69 JavaAnonRef descriptor_java = descriptor->getJavaObject();
72 if( !descriptor->readValue() ) {
74 return env->NewByteArray((jsize)0);
76 const size_t value_size = descriptor->value.size();
77 jbyteArray jres = env->NewByteArray((jsize)value_size);
78 env->SetByteArrayRegion(jres, 0, (jsize)value_size, (
const jbyte *)descriptor->value.get_ptr());
91 JavaAnonRef descriptor_java = descriptor->getJavaObject();
94 if(
nullptr == jval ) {
97 const size_t value_size = (size_t)env->GetArrayLength(jval);
98 if( 0 == value_size ) {
102 uint8_t * value_ptr = criticalArray.
get(jval, criticalArray.Mode::NO_UPDATE_AND_RELEASE);
103 if(
nullptr == value_ptr ) {
107 descriptor->value = value;
109 if( !descriptor->writeValue() ) {
jbyteArray Java_jau_direct_1bt_DBTGattDesc_readValueImpl(JNIEnv *env, jobject obj)
jstring Java_jau_direct_1bt_DBTGattDesc_toStringImpl(JNIEnv *env, jobject obj)
jboolean Java_jau_direct_1bt_DBTGattDesc_writeValueImpl(JNIEnv *env, jobject obj, jbyteArray jval)
void Java_jau_direct_1bt_DBTGattDesc_deleteImpl(JNIEnv *env, jobject obj, jlong nativeInstance)
Transient read only and endian aware octet data, i.e.
T * get(U jarray_val, Mode mode_val=UPDATE_AND_RELEASE)
Acquired the primitive array.
A std::shared_ptr<T> storage instance to be copied from and released into a java object's long native...
std::shared_ptr< T > * pointer() noexcept
Provides access to the shared_ptr<T> pointer, l-value of storage.
std::string toString() const noexcept
#define ERR_PRINT(...)
Use for unconditional error messages, prefix '[elapsed_time] Error @ FILE:LINE FUNC: '.
@ little
Identifier for little endian, equivalent to endian::little.
void java_exception_check_and_throw(JNIEnv *env, const char *file, int line)
Throws a C++ exception if a java exception occurred, otherwise do nothing.
jstring from_string_to_jstring(JNIEnv *env, const std::string &str)
std::shared_ptr< JavaAnon > JavaAnonRef
#define rethrow_and_raise_java_exception(E)
Re-throw current exception and raise respective java exception using any matching function above.