JerryScript debugger transport interface

Types

Summary

This context represents the current status of processing received data. The final state is returned by jerry_debugger_transport_receive and must be passed to after the message is processed.

Prototype

jerry_debugger_transport_header_t

Summary

Shared header for each transport interface. It mostly contains callback functions used by the JerryScript debugger server.

Prototype

  1. {
  2. /* The following fields must be filled before calling jerry_debugger_transport_add(). */
  3. jerry_debugger_transport_close_t close; /**< close connection callback */
  4. jerry_debugger_transport_send_t send; /**< send data callback */
  5. jerry_debugger_transport_receive_t receive; /**< receive data callback */
  6. /* The following fields are filled by jerry_debugger_transport_add(). */
  7. struct jerry_debugger_transport_layer_t *next_p; /**< next transport layer */
  8. } jerry_debugger_transport_header_t;

jerry_debugger_transport_close_t

Summary

Called when the connection is closed. Must release all resources (including the memory area for the transport interface) allocated for the transport interface.

Prototype

  1. typedef void (*jerry_debugger_transport_close_t) (struct jerry_debugger_transport_interface_t *header_p);

jerry_debugger_transport_send_t

Summary

Called when a message needs to be sent. Must either transmit the message or call the header_p->next_p->send() method.

Prototype

  1. uint8_t *message_p, size_t message_length);

Called during message processing. If messages are available it must return with the next message.

Prototype

Transport interface API functions

jerry_debugger_transport_add

Summary

Add a new interface to the transporation interface chain. The interface will be the first item of the interface chain.

Prototype

  1. void jerry_debugger_transport_add (jerry_debugger_transport_header_t *header_p,
  2. size_t send_message_header_size, size_t max_send_message_size,
  3. size_t receive_message_header_size, size_t max_receive_message_size);
  • send_message_header_size: size of the outgoing message header, can be 0.
  • max_send_message_size: maximum outgoing message size supported by the interface.
  • receive_message_header_size: size of the incoming message header, can be 0.
  • max_receive_message_size: maximum incoming message size supported by the interface.

jerry_debugger_transport_start

Summary

Starts the communication to the debugger client. Must be called after the connection is successfully established.

Prototype

  1. void jerry_debugger_transport_start (void);

jerry_debugger_transport_is_connected

Summary

Tells whether a debugger client is connected to the debugger server.

Prototype

  1. bool jerry_debugger_transport_is_connected (void);
  • return value: , if a client is connected, false otherwise.

Summary

Prototype

jerry_debugger_transport_send

Summary

Send message to the client.

Prototype

  1. bool jerry_debugger_transport_send (const uint8_t *message_p, size_t message_length);
  • message_p: message to be sent.
  • message_length: message length in bytes.
  • return value: true, if a client is still connected, false otherwise.

jerry_debugger_transport_receive

Summary

Receive message from the client.

Prototype

  1. bool jerry_debugger_transport_receive (jerry_debugger_transport_receive_context_t *context_p);
  • context_p: an unused .
  • return value: true, if a client is still connected, false otherwise.

jerry_debugger_transport_receive_completed

Summary

Must be called after returns with a valid message. Must not be called otherwise.

Prototype

  1. void jerry_debugger_transport_receive_completed (jerry_debugger_transport_receive_context_t *context_p);

Summary

Can be used to wait for incoming messages. Currently the delay is 100ms.