Skip to content

Commit

Permalink
feature(scouting): small comment fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
DariusIMP committed Aug 29, 2024
1 parent 1a21f4f commit 50282e2
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 7 deletions.
2 changes: 1 addition & 1 deletion zenoh-jni/src/scouting.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ pub unsafe extern "C" fn Java_io_zenoh_jni_JNIScout_00024Companion_scoutViaJNI(
.map(|it| env.auto_local(it))?;
let jlist = JList::from_env(&mut env, &locators)?;
for value in hello.locators() {
let locator = env.new_string(value.as_str()).unwrap();
let locator = env.new_string(value.as_str())?;
jlist.add(&mut env, &locator)?;
}
env.call_method(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
package io.zenoh.jni

/**
* Adapter class to handle the interactions with Zenoh through JNI for a [Queryable]
* Adapter class to handle the interactions with Zenoh through JNI for a [io.zenoh.queryable.Queryable]
*
* @property ptr: raw pointer to the underlying native Queryable.
*/
Expand Down
27 changes: 23 additions & 4 deletions zenoh-kotlin/src/commonMain/kotlin/io/zenoh/jni/JNIScout.kt
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
//
// Copyright (c) 2023 ZettaScale Technology
//
// This program and the accompanying materials are made available under the
// terms of the Eclipse Public License 2.0 which is available at
// http://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0
// which is available at https://www.apache.org/licenses/LICENSE-2.0.
//
// SPDX-License-Identifier: EPL-2.0 OR Apache-2.0
//
// Contributors:
// ZettaScale Zenoh Team, <[email protected]>
//

package io.zenoh.jni

import io.zenoh.Config
Expand All @@ -8,12 +22,13 @@ import io.zenoh.scouting.Hello
import io.zenoh.scouting.Scout
import io.zenoh.scouting.WhatAmI

/**
* Adapter class to handle the interactions with Zenoh through JNI for a [io.zenoh.scouting.Scout]
*
* @property ptr: raw pointer to the underlying native scout.
*/
class JNIScout(private val ptr: Long) {

fun close() {
freePtrViaJNI(ptr)
}

companion object {
fun <R> scout(
whatAmI: Set<WhatAmI>,
Expand Down Expand Up @@ -44,4 +59,8 @@ class JNIScout(private val ptr: Long) {
@Throws(Exception::class)
external fun freePtrViaJNI(ptr: Long)
}

fun close() {
freePtrViaJNI(ptr)
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,20 @@
//
// Copyright (c) 2023 ZettaScale Technology
//
// This program and the accompanying materials are made available under the
// terms of the Eclipse Public License 2.0 which is available at
// http://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0
// which is available at https://www.apache.org/licenses/LICENSE-2.0.
//
// SPDX-License-Identifier: EPL-2.0 OR Apache-2.0
//
// Contributors:
// ZettaScale Zenoh Team, <[email protected]>
//

package io.zenoh.jni.callbacks

internal fun interface JNIScoutCallback {

fun run(whatAmI: Int, zid: String, locators: List<String>)
}
}

0 comments on commit 50282e2

Please sign in to comment.