Skip to main content

CmdExchange

Function CmdExchange 

Source
#[unsafe(no_mangle)]
pub extern "C" fn CmdExchange( requestJSON: *mut c_char, responseJSON: *mut c_char, maxResponseLen: i32, ) -> i32
Expand description

Blocking call to send out request and wait for response from R/W with 1sec timeout

§Parameters

  • requestJSON: Request to R/W in JSON format
  • responseJSON: Buffer to store response from R/W in JSON format
  • maxResponseLen: Size of responseJSON buffer (minimum size is 4096 bytes)

§Returns

  • 0: Message send/receive succeeded
  • -1: COM not opened
  • -2: Communication error with R/W
  • -3: responseJSON buffer size not enough
  • -6: Link busy

§Safety

The caller must ensure:

  • requestJSON points to a valid null-terminated string
  • responseJSON points to a writable buffer of at least maxResponseLen bytes
  • maxResponseLen is positive and represents the actual buffer size (minimum 4096)