Skip to main content

pamoja_coap_server_send

Function pamoja_coap_server_send 

Source
#[unsafe(no_mangle)]
pub unsafe extern "C" fn pamoja_coap_server_send( server: *mut PamojaCoapServer, path: *const c_char, payload: *const u8, payload_len: usize, ) -> PamojaStatus
Expand description

Sets the state of a resource and notifies every observer of it.

This goes through the server’s publisher, so it does not wait for a receive running on another thread.

§Arguments

  • server - the server.
  • path - the resource’s path, as null-terminated UTF-8.
  • payload - its new state.
  • payload_len - the length of payload.

§Returns

PamojaStatus::Ok once each notification has left, or PamojaStatus::Closed if the server is not connected.

§Safety

server must be a live handle, path a valid null-terminated UTF-8 string, and payload must point to at least payload_len readable bytes or be null when that length is 0.