when i use that message to pass some data value to nordic device, in generic onoff server. i face problem that when i try to send the message to nordic device, it sends again again the message. In console log appear as resending the message in access layer. After 3 to 4 try it get canceled with a error message. I use docklight to check receive message in nordic device and it verify that it receive the message. i am using the nrf5 sdk 540 device to test.
message parameter contain [int8] array
import Foundation
public struct GenericConfigSet: GenericMessage, TransactionMessage, TransitionMessage {
public static let opCode: UInt32 = 0x8206
// public static let responseType: StaticMeshMessage.Type = GenericLevelStatus.self
public var tid: UInt8!
public var parameters: Data? {
let data = Data() + byteArray + tid
if let transitionTime = transitionTime, let delay = delay {
return data + transitionTime.rawValue + delay
} else {
return data
}
}
/// The target value of the Generic Level state.
public let byteArray: [UInt8]
public let transitionTime: TransitionTime?
public let delay: UInt8?
public init(parameter: [UInt8]) {
self.byteArray = parameter
self.transitionTime = nil
self.delay = nil
}
/// - parameters:
/// - transitionTime: The time that an element will take to transition
/// to the target state from the present state.
/// - delay: Message execution delay in 5 millisecond steps.
public init(parameter: [UInt8], transitionTime: TransitionTime, delay: UInt8) {
self.byteArray = parameter
self.transitionTime = transitionTime
self.delay = delay
}
public init?(parameters: Data) {
print("\n call by system \n")
guard parameters.count == 3 || parameters.count == 5 else {
return nil
}
byteArray = [parameters[0]] //check for any error later.
tid = parameters[2]
if parameters.count == 5 {
transitionTime = TransitionTime(rawValue: parameters[3])
delay = parameters[4]
} else {
transitionTime = nil
delay = nil
}
}
}


