Giter VIP home page Giter VIP logo

Comments (11)

philips77 avatar philips77 commented on July 28, 2024

Thank you for reporting the issue. I'll look into it and come back to you.

from ios-nrf-mesh-library.

philips77 avatar philips77 commented on July 28, 2024

For Acknowledged messages there's a timer on Access Layer that should try to retransmit the message and time out eventually.

from ios-nrf-mesh-library.

philips77 avatar philips77 commented on July 28, 2024

OK. I see where the issue may occur.

AccessLayer sets the repeat & timeout timer only for acknowledge messages sent to a Unicast Address:

// Set timers for the acknowledged messages.
// Acknowledged messages sent to a Group address won't await a Status.
if message is AcknowledgedMeshMessage,
destination.address.isUnicast {
createReliableContext(for: pdu, sentFrom: element, withTtl: initialTtl, using: keySet)
}

That means, that acknowledged messages sent to a Group Address (or Virtual Address) don't get that timer set. Such messages may be sent to 0+ nodes and the transmitter can receive 0+ responses. In that case, it is the underlying layer that should notify the network manager, just like for unacknowledged messages.

However, as you pointed out, when the Acknowledged Mesh Message is unsegmented, like ConfigOnOffSet, and sending the message fails, the network manager is never notified:

if !pdu.message!.isAcknowledged {
networkManager.notifyAbout(error: error, duringSendingMessage: pdu.message!,
from: localElement, to: pdu.destination)
}

I'll prepare a fix.

from ios-nrf-mesh-library.

philips77 avatar philips77 commented on July 28, 2024

image

from ios-nrf-mesh-library.

philips77 avatar philips77 commented on July 28, 2024

Btw, for multicast addresses it is recommended not to use Acknowledged messages, but their Unacknowledged counterparts. This significantly decreases the traffic in the network.

from ios-nrf-mesh-library.

philips77 avatar philips77 commented on July 28, 2024

Hmm... I did some more digging and seems like the Network Layer doesn't throw bearerDidClose when the message is sent to a group address, as such message may be handled internally:

// Loopback interface.
if shouldLoopback(networkPdu) {
handle(incomingPdu: networkPdu.pdu, ofType: type)
// Messages sent with TTL = 1 will only be sent locally.
guard ttl != 1 else { return }
if isLocalUnicastAddress(networkPdu.destination) {
// No need to send messages targeting local Unicast Addresses.
return
}
// If the message was sent locally, don't report Bearer closer error.
try? transmitter.send(networkPdu.pdu, ofType: type)
} else {

This is the shouldLoopback method:

/// Returns whether the PDU should loop back for local processing.
///
/// - parameter networkPdu: The PDU to check.
func shouldLoopback(_ networkPdu: NetworkPdu) -> Bool {
let address = networkPdu.destination
return address.isGroup || address.isVirtual || isLocalUnicastAddress(address)
}

As you're getting that error, that means, that you're sending the message to a Unicast Address. In that case, the network manager should wait until the response is received from the target, which happens on Access Layer.
I'll leave #600 open, but don't think it's required.

from ios-nrf-mesh-library.

philips77 avatar philips77 commented on July 28, 2024

Could you say what message are you trying to send exactly, what are your network parameters (default?) and what is the destination address of the message?

from ios-nrf-mesh-library.

jack8525 avatar jack8525 commented on July 28, 2024

Thank you for your help. I just send some GenericOnOffSet to a Unicast Address when not connected.In this case, a timeout will not be thrown?

from ios-nrf-mesh-library.

philips77 avatar philips77 commented on July 28, 2024

There will be a timeout. The timeout is set using:

/// Sets the timeout for receiving a response to an acknowledged access message.
///
/// The ``MeshNetworkDelegate/meshNetworkManager(_:failedToSendMessage:from:to:error:)-7iylf``
/// callback will be called when the response is not received before the timeout expires..
///
/// - parameter timeout: The timeout after which the ``AccessError/timeout``
/// is reported. This shall be set to a minimum of 30 seconds,
/// which is also the default value.
/// - seeAlso: ``NetworkParameters/acknowledgmentMessageTimeout``
public func discardAcknowledgedMessages(after timeout: TimeInterval) {
networkParameters.acknowledgmentMessageTimeout = timeout
}

Documentatuion

from ios-nrf-mesh-library.

jack8525 avatar jack8525 commented on July 28, 2024

I found failedToSendMessage is no callback. Because Address change to MeshMessage.
After fix it.
I can handle the timeout here.

from ios-nrf-mesh-library.

jack8525 avatar jack8525 commented on July 28, 2024

image
Can I handle deliveryCallbacks here?

from ios-nrf-mesh-library.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.