mqttBrokerEventListenerOnMessagePublished function

void mqttBrokerEventListenerOnMessagePublished(
  1. int uniffiHandle,
  2. RustBuffer clientId,
  3. RustBuffer topic,
  4. int qos,
  5. Pointer<Void> outReturn,
  6. Pointer<RustCallStatus> callStatus,
)

Implementation

void mqttBrokerEventListenerOnMessagePublished(
  int uniffiHandle,
  RustBuffer clientId,
  RustBuffer topic,
  int qos,
  Pointer<Void> outReturn,
  Pointer<RustCallStatus> callStatus,
) {
  final status = callStatus.ref;
  try {
    final obj = FfiConverterCallbackInterfaceMqttBrokerEventListener._handleMap
        .get(uniffiHandle);
    final arg0 = FfiConverterString.lift(clientId);
    final arg1 = FfiConverterString.lift(topic);
    final arg2 = FfiConverterQoS.read(createUint8ListFromInt(qos)).value;
    obj.onMessagePublished(arg0, arg1, arg2);
    status.code = CALL_SUCCESS;
  } catch (e) {
    status.code = CALL_UNEXPECTED_ERROR;
    status.errorBuf = FfiConverterString.lower(e.toString());
  }
}