|
Swadge ESP32-S2
2.0.0
APIs to develop for the Magfest Swadge
|
All the state variables required for a P2P session with another Swadge.
#include <p2pConnection.h>
Data Fields | |
| uint8_t | modeId |
| The mode ID set by the mode using P2P. | |
| uint8_t | incomingModeId |
| A mode ID to listen for which is different than initialized mode ID. See p2pSetAsymmetric(). | |
| p2pConMsg_t | conMsg |
| The connection message to transmit. | |
| p2pCommonHeader_t | startMsg |
| The start message to transmit. | |
| p2pDataMsg_t | ackMsg |
| The acknowledge message to transmit. | |
| uint8_t | dataInAckLen |
| The length of any extra data which was appended to the ACK, see p2pSetDataInAck(). | |
| p2pConCbFn | conCbFn |
| A callback function called during the connection process. | |
| p2pMsgRxCbFn | msgRxCbFn |
| A callback function called when receiving a message. | |
| p2pMsgTxCbFn | msgTxCbFn |
| A callback function called when transmitting a message. | |
| int8_t | connectionRssi |
| The minimum RSSI required to begin a connection. | |
| struct { | |
| bool | isWaitingForAck |
| true if waiting for an ACK after transmitting a message | |
| p2pDataMsg_t | msgToAck |
| A transmitted message which is waiting for an ACK. | |
| uint16_t | msgToAckLen |
| The length of the message which is waiting for an ACK. | |
| uint32_t | timeSentUs |
| The time the message is waiting for an ACK was transmitted. | |
| p2pAckSuccessFn | SuccessFn |
| A callback function to be called if the message is ACKed. | |
| p2pAckFailureFn | FailureFn |
| A callback function to be called if the message is not ACKed. | |
| } | ack |
| Variables used for acknowledging and retrying messages. | |
| struct { | |
| playOrder_t | playOrder |
| Either GOING_FIRST or GOING_SECOND depending on how the handshake went. | |
| uint8_t | myMac [6] |
| This Swadge's MAC address. | |
| uint8_t | otherMac [6] |
| The other Swadge's MAC address. | |
| bool | isActive |
| true if the connection process has started | |
| bool | isConnected |
| true if connected to another Swadge | |
| bool | broadcastReceived |
| true if a broadcast was received to start the connection handshake | |
| bool | rxGameStartMsg |
| true if the other Swadge's game start message was received | |
| bool | rxGameStartAck |
| True if this Swadge's game start message was acknowledged. | |
| bool | otherMacReceived |
| true if the other Swadge's MAC address has been received | |
| uint8_t | mySeqNum |
| The current sequence number used for transmissions. | |
| uint8_t | lastSeqNum |
| The last sequence number used for transmissions. | |
| } | cnc |
| Connection state variables. | |
| struct { | |
| esp_timer_handle_t | TxRetry |
| A timer used to retry a transmission multiple times if not acknowledged. | |
| esp_timer_handle_t | TxAllRetries |
| A timer used to cancel a transmission if all attempts failed. | |
| esp_timer_handle_t | Connection |
| A timer used to cancel a connection if the handshake fails. | |
| esp_timer_handle_t | Reinit |
| A timer used to restart P2P after any complete failures. | |
| } | tmr |
| The timers used for connection and ACKing. | |
| uint8_t modeId |
The mode ID set by the mode using P2P.
| uint8_t incomingModeId |
A mode ID to listen for which is different than initialized mode ID. See p2pSetAsymmetric().
| p2pConMsg_t conMsg |
The connection message to transmit.
| p2pCommonHeader_t startMsg |
The start message to transmit.
| p2pDataMsg_t ackMsg |
The acknowledge message to transmit.
| uint8_t dataInAckLen |
The length of any extra data which was appended to the ACK, see p2pSetDataInAck().
| p2pConCbFn conCbFn |
A callback function called during the connection process.
| p2pMsgRxCbFn msgRxCbFn |
A callback function called when receiving a message.
| p2pMsgTxCbFn msgTxCbFn |
A callback function called when transmitting a message.
| int8_t connectionRssi |
The minimum RSSI required to begin a connection.
| struct { ... } ack |
Variables used for acknowledging and retrying messages.
| struct { ... } cnc |
Connection state variables.
| struct { ... } tmr |
The timers used for connection and ACKing.