1

I am new to tizen development and creating companion app. in the example provided , hello message is using sap_peer_agent_send_data and hello accessory is using sap_socket_send_data. basically i don't understand the difference between them.

When to use sap_socket_send_data and when to use sap_peer_agent_send_data in Tizen Companion watch usingSAP.

siva
  • 31
  • 2

1 Answers1

1

Both functions sends data between peers. The difference is that:

  • sap_socket_send_data()
    • operates on an open socket (sap_socket_h) - connection established by the sap_agent_request_service_connection()
    • the message is received through the socket by the other end
    • sockets allow you to have multiple, parallel data exchanges and better control over the communication
  • sap_peer_agent_send_data()
    • operates on a sap_agent_h, all you need is to discover the peer
    • the message is received with the SAMessage subclass on Java side
    • is only available if the SAP_FEATURE_MESSAGE is supported (you can check it with sap_peer_agent_is_feature_enabled(), but it should not be an issue)
    • is probably easier to use in a simple application which does not need all of the service connection socket features (like data rate, priority configuration).
wiertel
  • 92
  • 7
  • can you send json data from phone to watch and watch to phone using sap_peer_agent_send_data? Beside I read also somewhere that if you use SAP instead of accessory SDK, you need to install watch wear app from the store to do connection first but accessory sdk has built in connection capability without using this galaxy wearable app, not sure if it is correct. – Emil Aug 03 '19 at 00:14