Function anjay_disable_server_with_timeout

Function Documentation

int anjay_disable_server_with_timeout(anjay_t *anjay, anjay_ssid_t ssid, avs_time_duration_t timeout)

This function shall be called when an LwM2M Server Object shall be disabled. The standard case for this is when Execute is performed on the Disable resource (/1/x/4). It may also be used to prevent reconnections if the server becomes unreachable.

The server will become disabled during next anjay_sched_run call.

If the server is already disabled, its re-enable action will be re-scheduled or cancelled, according to the timeout argument.

NOTE: disabling a server with dual binding (e.g. UDP+SMS trigger) closes both communication channels. Shutting down only one of them requires changing the Binding Resource in Server object.

NOTE: Disabled servers and the time at which those servers will be reenabled is persisted and restored by anjay_new_from_core_persistence and anjay_delete_with_core_persistence .

Parameters:
  • anjay – Anjay object to operate on.

  • ssid – Short Server ID of the server to put in a disabled state.

  • timeout – Disable timeout. If set to AVS_TIME_DURATION_INVALID, the server will remain disabled until explicit call to anjay_enable_server . Otherwise, the server will get enabled automatically after timeout .

Returns:

0 on success, a negative value in case of error.