26#include "org_direct_bt_EInfoReport.h"
54 return (jlong) (intptr_t)
nullptr;
70 return (jlong) (intptr_t)
nullptr;
95 if(
nullptr != sref.
pointer() ) {
96 std::shared_ptr<EInfoReport>* sref_ptr = castInstance<EInfoReport>(nativeInstance);
117 return static_cast<jint
>(
number( ref->set(*ref_other) ) );
147 if(
nullptr == jaddress ) {
150 const size_t address_size = env->GetArrayLength(jaddress);
151 if(
sizeof(
EUI48) > address_size ) {
155 uint8_t * address_ptr = criticalArray.
get(jaddress, criticalArray.Mode::NO_UPDATE_AND_RELEASE);
156 if(
nullptr == address_ptr ) {
159 const EUI48& address = *
reinterpret_cast<EUI48 *
>(address_ptr);
161 ref->setAddress(address);
175 ref->setRSSI(
static_cast<int8_t
>(jrssi));
189 ref->setTxPower(
static_cast<int8_t
>(jtxp));
203 ref->setFlags(
static_cast<GAPFlags>(jf));
217 ref->addFlags(
static_cast<GAPFlags>(jf));
247 ref->setShortName(sname);
263 ref->addService(uuid);
277 ref->setServicesComplete(JNI_TRUE==jv);
291 ref->setDeviceClass(
static_cast<uint32_t
>(jv));
305 ref->setDeviceID(
static_cast<uint16_t
>(jsource),
static_cast<uint16_t
>(jvendor),
static_cast<uint16_t
>(jproduct),
static_cast<uint16_t
>(jversion));
319 ref->setConnInterval(
static_cast<uint16_t
>(jmin),
static_cast<uint16_t
>(jmax));
333 return static_cast<jlong
>( ref->getTimestamp() );
348 return static_cast<jint
>(
number( ref->getEIRDataMask() ) );
373 return static_cast<jbyte
>(
number( ref->getFlags() ) );
388 return static_cast<jbyte
>( ref->getADAddressType() );
403 return static_cast<jbyte
>(
number( ref->getAddressType() ) );
418 const EUI48 & addr = ref->getAddress();
419 jbyteArray jaddr = env->NewByteArray(
sizeof(addr));
420 env->SetByteArrayRegion(jaddr, 0,
sizeof(addr), (
const jbyte*)(addr.
b));
466 return static_cast<jbyte
>( ref->getRSSI() );
481 return static_cast<jbyte
>( ref->getTxPower() );
492 std::shared_ptr<ManufactureSpecificData> mdata = ref->getManufactureSpecificData();
494 jclass map_cls =
search_class(env,
"java/util/HashMap");
495 jmethodID map_ctor =
search_method(env, map_cls,
"<init>",
"(I)V",
false);
496 jmethodID map_put =
search_method(env, map_cls,
"put",
"(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;",
false);
498 jclass short_cls =
search_class(env,
"java/lang/Short");
499 jmethodID short_ctor =
search_method(env, short_cls,
"<init>",
"(S)V",
false);
500 jobject result =
nullptr;
502 if(
nullptr != mdata ) {
503 result = env->NewObject(map_cls, map_ctor, 1);
504 jbyteArray arr = env->NewByteArray( (jsize) mdata->getData().size() );
505 env->SetByteArrayRegion(arr, 0, (jsize) mdata->getData().size(), (
const jbyte *)mdata->getData().get_ptr());
506 jobject key = env->NewObject(short_cls, short_ctor, mdata->getCompany());
507 env->CallObjectMethod(result, map_put, key, arr);
509 env->DeleteLocalRef(arr);
510 env->DeleteLocalRef(key);
512 result = env->NewObject(map_cls, map_ctor, 0);
514 if (
nullptr == result) {
533 jau::function<jobject(JNIEnv*,
const std::shared_ptr<const jau::uuid_t>&)> ctor_uuid2string =
534 [](JNIEnv *env_,
const std::shared_ptr<const jau::uuid_t>& uuid_ptr)->jobject {
537 return convert_vector_sharedptr_to_jarraylist<jau::darray<std::shared_ptr<const jau::uuid_t>>,
const jau::uuid_t>(env, service_uuids, ctor_uuid2string);
552 return ref->getServicesComplete() ? JNI_TRUE : JNI_FALSE;
567 return static_cast<jint
>( ref->getDeviceClass() );
582 return static_cast<jshort
>( ref->getDeviceIDSource() );
597 return static_cast<jshort
>( ref->getDeviceIDVendor() );
612 return static_cast<jshort
>( ref->getDeviceIDProduct() );
627 return static_cast<jshort
>( ref->getDeviceIDVersion() );
643 if(
nullptr == jminmax ) {
646 const size_t array_size = env->GetArrayLength(jminmax);
647 if( 2 > array_size ) {
651 uint16_t * array_ptr = criticalArray.
get(jminmax, criticalArray.Mode::UPDATE_AND_RELEASE);
652 if(
nullptr == array_ptr ) {
655 ref->getConnInterval(array_ptr[0], array_ptr[1]);
void Java_org_direct_1bt_EInfoReport_clear(JNIEnv *env, jobject obj)
jint Java_org_direct_1bt_EInfoReport_setImpl(JNIEnv *env, jobject obj, jobject jeir_other)
void Java_org_direct_1bt_EInfoReport_dtorImpl(JNIEnv *env, jclass clazz, jlong nativeInstance)
void Java_org_direct_1bt_EInfoReport_setDeviceClass(JNIEnv *env, jobject obj, jint jv)
jint Java_org_direct_1bt_EInfoReport_getSourceImpl(JNIEnv *env, jobject obj)
jbyte Java_org_direct_1bt_EInfoReport_getTxPower(JNIEnv *env, jobject obj)
jshort Java_org_direct_1bt_EInfoReport_getDeviceIDSource(JNIEnv *env, jobject obj)
void Java_org_direct_1bt_EInfoReport_replace_nativeImpl(JNIEnv *env, jobject obj, jlong nativeInstanceOther)
void Java_org_direct_1bt_EInfoReport_setTxPower(JNIEnv *env, jobject obj, jbyte jtxp)
jint Java_org_direct_1bt_EInfoReport_getEIRDataMaskImpl(JNIEnv *env, jobject obj)
jbyte Java_org_direct_1bt_EInfoReport_getRSSI(JNIEnv *env, jobject obj)
jlong Java_org_direct_1bt_EInfoReport_getTimestamp(JNIEnv *env, jobject obj)
jshort Java_org_direct_1bt_EInfoReport_getDeviceIDVersion(JNIEnv *env, jobject obj)
void Java_org_direct_1bt_EInfoReport_setFlagsImpl(JNIEnv *env, jobject obj, jbyte jf)
void Java_org_direct_1bt_EInfoReport_getConnInterval(JNIEnv *env, jobject obj, jshortArray jminmax)
void Java_org_direct_1bt_EInfoReport_addFlagImpl(JNIEnv *env, jobject obj, jbyte jf)
void Java_org_direct_1bt_EInfoReport_setAddressImpl(JNIEnv *env, jobject obj, jbyteArray jaddress)
void Java_org_direct_1bt_EInfoReport_setDeviceID(JNIEnv *env, jobject obj, jshort jsource, jshort jvendor, jshort jproduct, jshort jversion)
jshort Java_org_direct_1bt_EInfoReport_getDeviceIDVendor(JNIEnv *env, jobject obj)
jint Java_org_direct_1bt_EInfoReport_getDeviceClass(JNIEnv *env, jobject obj)
void Java_org_direct_1bt_EInfoReport_setServicesComplete(JNIEnv *env, jobject obj, jboolean jv)
jstring Java_org_direct_1bt_EInfoReport_getName(JNIEnv *env, jobject obj)
void Java_org_direct_1bt_EInfoReport_setConnInterval(JNIEnv *env, jobject obj, jshort jmin, jshort jmax)
jstring Java_org_direct_1bt_EInfoReport_getDeviceIDModalias(JNIEnv *env, jobject obj)
jobject Java_org_direct_1bt_EInfoReport_getServices(JNIEnv *env, jobject obj)
void Java_org_direct_1bt_EInfoReport_setRSSI(JNIEnv *env, jobject obj, jbyte jrssi)
void Java_org_direct_1bt_EInfoReport_setShortName(JNIEnv *env, jobject obj, jstring jsname)
jobject Java_org_direct_1bt_EInfoReport_getManufacturerData(JNIEnv *env, jobject obj)
jshort Java_org_direct_1bt_EInfoReport_getDeviceIDProduct(JNIEnv *env, jobject obj)
jstring Java_org_direct_1bt_EInfoReport_toString(JNIEnv *env, jobject obj, jboolean includeServices)
jbyte Java_org_direct_1bt_EInfoReport_getADAddressType(JNIEnv *env, jobject obj)
void Java_org_direct_1bt_EInfoReport_setName(JNIEnv *env, jobject obj, jstring jname)
jboolean Java_org_direct_1bt_EInfoReport_getServicesComplete(JNIEnv *env, jobject obj)
void Java_org_direct_1bt_EInfoReport_addService(JNIEnv *env, jobject obj, jstring juuid)
jstring Java_org_direct_1bt_EInfoReport_eirDataMaskToString(JNIEnv *env, jobject obj)
jstring Java_org_direct_1bt_EInfoReport_getShortName(JNIEnv *env, jobject obj)
jbyte Java_org_direct_1bt_EInfoReport_getAddressTypeImpl(JNIEnv *env, jobject obj)
jbyteArray Java_org_direct_1bt_EInfoReport_getAddressImpl(JNIEnv *env, jobject obj)
jlong Java_org_direct_1bt_EInfoReport_ctorImpl1(JNIEnv *env, jobject obj)
void Java_org_direct_1bt_EInfoReport_setAddressTypeImpl(JNIEnv *env, jobject obj, jbyte jat)
jlong Java_org_direct_1bt_EInfoReport_ctorImpl2(JNIEnv *env, jobject obj, jlong nativeInstanceOther)
jbyte Java_org_direct_1bt_EInfoReport_getFlagsImpl(JNIEnv *env, jobject obj)
Collection of 'Extended Advertising Data' (EAD), 'Advertising Data' (AD) or 'Extended Inquiry Respons...
Implementation of a dynamic linear array storage, aka vector.
Class template jau::function is a general-purpose static-polymorphic function wrapper.
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...
const std::shared_ptr< T > & shared_ptr() const
Provides access to const reference of shared_ptr<T>, r-value.
std::shared_ptr< T > * pointer() noexcept
Provides access to the shared_ptr<T> pointer, l-value of storage.
std::string toString() const noexcept
jlong release_to_jlong() noexcept
Release ownership and return the jlong representation of the shared_ptr<T> storage.
void release_into_object(JNIEnv *env, jobject obj)
Deletes the std::shared_ptr<T> storage of the target java object if exists first and writes this inst...
static std::unique_ptr< uuid_t > create(TypeSize const t, uint8_t const *const buffer, lb_endian_t const le_or_be)
std::string to_string(const alphabet &v) noexcept
BDAddressType
BT Core Spec v5.2: Vol 3, Part C Generic Access Profile (GAP): 15.1.1.1 Public Bluetooth address.
GAPFlags
GAP Flags values, see Bluetooth Core Specification Supplement V9, Part A: 1.3, p 12 pp.
constexpr uint32_t number(const iostate rhs) noexcept
jstring from_string_to_jstring(JNIEnv *env, const std::string &str)
jmethodID search_method(JNIEnv *env, jclass clazz, const char *method_name, const char *prototype, bool is_static)
std::string from_jstring_to_string(JNIEnv *env, jstring str)
jclass search_class(JNIEnv *env, const char *clazz_name)
#define rethrow_and_raise_java_exception(E)
Re-throw current exception and raise respective java exception using any matching function above.
A packed 48 bit EUI-48 identifier, formerly known as MAC-48 or simply network device MAC address (Med...