Skip to content

Commit

Permalink
AP_Networking: removed unuused send_udp in ChibiOS backend
Browse files Browse the repository at this point in the history
  • Loading branch information
tridge authored and magicrub committed Nov 15, 2023
1 parent 537222c commit f2ec539
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 30 deletions.
29 changes: 0 additions & 29 deletions libraries/AP_Networking/AP_Networking_ChibiOS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -143,34 +143,5 @@ void AP_Networking_ChibiOS::update()
}
}

/*
send a UDP packet
*/
int32_t AP_Networking_ChibiOS::send_udp(struct udp_pcb *pcb, const ip4_addr_t &ip4_addr, const uint16_t port, const uint8_t* data, uint16_t data_len)
{
if (pcb == nullptr) {
return ERR_ARG;
}

data_len = (data == nullptr) ? 0 : data_len;

struct pbuf *p = pbuf_alloc(PBUF_TRANSPORT, data_len, PBUF_RAM);
if (p == nullptr) {
return ERR_MEM;
}

ip_addr_t dst;
ip_addr_copy_from_ip4(dst, ip4_addr);

if (data_len > 0) {
memcpy(p->payload, data, data_len);
}

const err_t err = udp_sendto(pcb, p, &dst, port);
pbuf_free(p);

return err == ERR_OK ? data_len : err;
}

#endif // AP_NETWORKING_BACKEND_CHIBIOS

1 change: 0 additions & 1 deletion libraries/AP_Networking/AP_Networking_ChibiOS.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ class AP_Networking_ChibiOS : public AP_Networking_Backend

private:
bool allocate_buffers(void);
int32_t send_udp(struct udp_pcb *pcb, const struct ip4_addr &ip4_addr, const uint16_t port, const uint8_t* data, uint16_t data_len);

private:
struct lwipthread_opts *lwip_options;
Expand Down

0 comments on commit f2ec539

Please sign in to comment.