A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/mcci-catena/arduino-lmic/commit/53c27e4534fbdc0a16f90019527e6242a14bfd13 below:

add EV_TXCANCELED when pending tx is canceled · mcci-catena/arduino-lmic@53c27e4 · GitHub

File tree Expand file treeCollapse file tree 2 files changed

+35

-6

lines changed

Filter options

Expand file treeCollapse file tree 2 files changed

+35

-6

lines changed Original file line number Diff line number Diff line change

@@ -495,18 +495,30 @@ static void reportEvent (ev_t ev) {

495 495

// tell the client about completed transmits -- the buffer

496 496

// is now available again. We use set notation again in case

497 497

// we later discover another event completes messages

498 -

if ((evSet & (1u<<EV_TXCOMPLETE)) != 0) {

498 +

if ((evSet & ((1u<<EV_TXCOMPLETE) | (1u<<EV_TXCANCELED))) != 0) {

499 499

lmic_txmessage_cb_t * const pTxMessageCb = LMIC.txMessageCb;

500 500 501 501

if (pTxMessageCb != NULL) {

502 +

int fSuccess;

502 503

// reset before notifying user. If we reset after

503 504

// notifying, then if user does a recursive call

504 505

// in their message processing

505 506

// function, we would clobber the value

506 507

LMIC.txMessageCb = NULL;

507 508 509 +

// compute exit status

510 +

if (ev == EV_TXCANCELED) {

511 +

// canceled: unsuccessful.

512 +

fSuccess = 0;

513 +

} else if (/* ev == EV_TCCOMPLETE && */ LMIC.pendTxConf) {

514 +

fSuccess = (LMIC.txrxFlags & TXRX_ACK) != 0;

515 +

} else {

516 +

// unconfirmed uplinks are successul if they were sent.

517 +

fSuccess = 1;

518 +

}

519 + 508 520

// notify the user.

509 -

pTxMessageCb(LMIC.txMessageUserData, ! (LMIC.txrxFlags & TXRX_NACK));

521 +

pTxMessageCb(LMIC.txMessageUserData, fSuccess);

510 522

}

511 523

}

512 524

@@ -1660,6 +1672,18 @@ static void startJoining (xref2osjob_t osjob) {

1660 1672

reportEvent(EV_JOINING);

1661 1673

}

1662 1674 1675 +

// reset the joined-to-network state (and clean up)

1676 +

void LMIC_unjoin(void) {

1677 +

// reset any joining flags

1678 +

LMIC.opmode &= ~(OP_SCAN|OP_REJOIN);

1679 + 1680 +

// put us in unjoined state:

1681 +

LMIC.devaddr = 0;

1682 + 1683 +

// clear transmit.

1684 +

LMIC_clrTxData();

1685 +

}

1686 + 1663 1687

// Start join procedure if not already joined.

1664 1688

bit_t LMIC_startJoining (void) {

1665 1689

if( LMIC.devaddr == 0 ) {

@@ -2111,8 +2135,13 @@ void LMIC_init (void) {

2111 2135 2112 2136 2113 2137

void LMIC_clrTxData (void) {

2138 +

bit_t const txActive = LMIC.opmode & OP_TXDATA;

2114 2139

LMIC.opmode &= ~(OP_TXDATA|OP_TXRXPEND|OP_POLL);

2115 2140

LMIC.pendTxLen = 0;

2141 + 2142 +

if (txActive)

2143 +

reportEvent(EV_TXCANCELED);

2144 + 2116 2145

if( (LMIC.opmode & (OP_JOINING|OP_SCAN)) != 0 ) // do not interfere with JOINING

2117 2146

return;

2118 2147

os_clearCallback(&LMIC.osjob);

Original file line number Diff line number Diff line change

@@ -235,7 +235,7 @@ enum _ev_t { EV_SCAN_TIMEOUT=1, EV_BEACON_FOUND,

235 235

EV_JOINED, EV_RFU1, EV_JOIN_FAILED, EV_REJOIN_FAILED,

236 236

EV_TXCOMPLETE, EV_LOST_TSYNC, EV_RESET,

237 237

EV_RXCOMPLETE, EV_LINK_DEAD, EV_LINK_ALIVE, EV_SCAN_FOUND,

238 -

EV_TXSTART };

238 +

EV_TXSTART, EV_TXCANCELED };

239 239

typedef enum _ev_t ev_t;

240 240 241 241

enum {

@@ -445,8 +445,11 @@ void LMIC_selectSubBand(u1_t band);

445 445 446 446

void LMIC_setDrTxpow (dr_t dr, s1_t txpow); // set default/start DR/txpow

447 447

void LMIC_setAdrMode (bit_t enabled); // set ADR mode (if mobile turn off)

448 + 448 449

#if !defined(DISABLE_JOIN)

449 450

bit_t LMIC_startJoining (void);

451 +

void LMIC_tryRejoin (void);

452 +

void LMIC_unjoin (void);

450 453

#endif

451 454 452 455

void LMIC_shutdown (void);

@@ -467,9 +470,6 @@ void LMIC_disableTracking (void);

467 470

void LMIC_stopPingable (void);

468 471

void LMIC_setPingable (u1_t intvExp);

469 472

#endif

470 -

#if !defined(DISABLE_JOIN)

471 -

void LMIC_tryRejoin (void);

472 -

#endif

473 473 474 474

void LMIC_setSession (u4_t netid, devaddr_t devaddr, xref2u1_t nwkKey, xref2u1_t artKey);

475 475

void LMIC_setLinkCheckMode (bit_t enabled);

You can’t perform that action at this time.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4