diff --git a/app/other/airbraker/sample.yaml b/app/other/airbraker/sample.yaml index 677b09d2b..6a3f53b9f 100644 --- a/app/other/airbraker/sample.yaml +++ b/app/other/airbraker/sample.yaml @@ -1,5 +1,5 @@ sample: - description: + description: airbrake_ctrler name: airbrake_ctrler common: build_only: true diff --git a/app/payload/control_freak/board-setup/sample.yaml b/app/payload/control_freak/board-setup/sample.yaml index 277a1dcff..ef5782581 100644 --- a/app/payload/control_freak/board-setup/sample.yaml +++ b/app/payload/control_freak/board-setup/sample.yaml @@ -1,5 +1,5 @@ sample: - description: + description: control_freak bring up and debugging name: control_freak bring up and debugging common: build_only: true diff --git a/app/payload/control_freak/flight-software/sample.yaml b/app/payload/control_freak/flight-software/sample.yaml index f40e02dbd..fc0619683 100644 --- a/app/payload/control_freak/flight-software/sample.yaml +++ b/app/payload/control_freak/flight-software/sample.yaml @@ -1,5 +1,5 @@ sample: - description: + description: control_freak name: control_freak common: build_only: true diff --git a/app/payload/control_freak/ground_station2/sample.yaml b/app/payload/control_freak/ground_station2/sample.yaml index f40e02dbd..fc0619683 100644 --- a/app/payload/control_freak/ground_station2/sample.yaml +++ b/app/payload/control_freak/ground_station2/sample.yaml @@ -1,5 +1,5 @@ sample: - description: + description: control_freak name: control_freak common: build_only: true diff --git a/app/payload/control_freak/imagine/sample.yaml b/app/payload/control_freak/imagine/sample.yaml index 277a1dcff..ef5782581 100644 --- a/app/payload/control_freak/imagine/sample.yaml +++ b/app/payload/control_freak/imagine/sample.yaml @@ -1,5 +1,5 @@ sample: - description: + description: control_freak bring up and debugging name: control_freak bring up and debugging common: build_only: true diff --git a/app/payload/control_freak/radio_test/sample.yaml b/app/payload/control_freak/radio_test/sample.yaml index 277a1dcff..ef5782581 100644 --- a/app/payload/control_freak/radio_test/sample.yaml +++ b/app/payload/control_freak/radio_test/sample.yaml @@ -1,5 +1,5 @@ sample: - description: + description: control_freak bring up and debugging name: control_freak bring up and debugging common: build_only: true diff --git a/app/samples/compression/sample.yaml b/app/samples/compression/sample.yaml index d7b354c84..22284ec63 100644 --- a/app/samples/compression/sample.yaml +++ b/app/samples/compression/sample.yaml @@ -1,5 +1,5 @@ sample: - description: + description: compression name: compression common: build_only: true diff --git a/app/samples/datalogger/sample.yaml b/app/samples/datalogger/sample.yaml index aa1c297f0..30f6c37a5 100644 --- a/app/samples/datalogger/sample.yaml +++ b/app/samples/datalogger/sample.yaml @@ -1,5 +1,5 @@ sample: - description: + description: datalogger name: datalogger common: build_only: true diff --git a/app/samples/gpio_blinky/sample.yaml b/app/samples/gpio_blinky/sample.yaml index 5e2da7df6..9a6d7fc15 100644 --- a/app/samples/gpio_blinky/sample.yaml +++ b/app/samples/gpio_blinky/sample.yaml @@ -1,5 +1,5 @@ sample: - description: + description: gpio-blinky name: gpio-blinky common: build_only: true diff --git a/app/samples/littlefs/sample.yaml b/app/samples/littlefs/sample.yaml index b5c1bbba6..b3767194a 100644 --- a/app/samples/littlefs/sample.yaml +++ b/app/samples/littlefs/sample.yaml @@ -1,5 +1,5 @@ sample: - description: + description: littlefs name: littlefs common: build_only: true diff --git a/app/samples/littlefs/src/main.c b/app/samples/littlefs/src/main.c index 78f34cc84..fb4826aaf 100644 --- a/app/samples/littlefs/src/main.c +++ b/app/samples/littlefs/src/main.c @@ -35,7 +35,7 @@ FS_LITTLEFS_DECLARE_CUSTOM_CONFIG(lfs3, 4, 16, 16, 64, 32); // FS_LITTLEFS_DECLARE_DEFAULT_CONFIG(lfs3); static struct fs_mount_t lfs3_mnt = {.type = FS_LITTLEFS, .fs_data = &lfs3, - .storage_dev = (void*) FIXED_PARTITION_ID(ext_storage_3), + .storage_dev = (void*) PARTITION_ID(ext_storage_3), .mnt_point = "/lfs3"}; // create peripherals from devicetree @@ -104,7 +104,7 @@ void print_statvfs(char* fname) { /** * @brief Clear the entire flash area - * @param fa_id ID of the flash area, usually a result of FIXED_PARTITION_ID + * @param fa_id ID of the flash area, usually a result of PARTITION_ID */ int32_t clear_flash_area(uint8_t fa_id) { int32_t ret = 0; diff --git a/app/samples/lora_bcast/sample.yaml b/app/samples/lora_bcast/sample.yaml index 8ec058042..b9c58830e 100644 --- a/app/samples/lora_bcast/sample.yaml +++ b/app/samples/lora_bcast/sample.yaml @@ -1,5 +1,5 @@ sample: - description: + description: lora-back-and-forth name: lora-back-and-forth common: build_only: true diff --git a/app/samples/message_passing/sample.yaml b/app/samples/message_passing/sample.yaml index 7918fc08e..3ba63f701 100644 --- a/app/samples/message_passing/sample.yaml +++ b/app/samples/message_passing/sample.yaml @@ -1,5 +1,5 @@ sample: - description: + description: message-passing name: message-passing common: build_only: true diff --git a/app/samples/openrocket_sensors/sample.yaml b/app/samples/openrocket_sensors/sample.yaml index 7c5a990b4..40a5e8057 100644 --- a/app/samples/openrocket_sensors/sample.yaml +++ b/app/samples/openrocket_sensors/sample.yaml @@ -1,5 +1,5 @@ sample: - description: + description: openrocket-sensors name: openrocket-sensors common: build_only: true diff --git a/app/samples/phase_detection/sample.yaml b/app/samples/phase_detection/sample.yaml index 4b07276d2..14591ee3e 100644 --- a/app/samples/phase_detection/sample.yaml +++ b/app/samples/phase_detection/sample.yaml @@ -1,5 +1,5 @@ sample: - description: + description: phase-detection name: phase-detection common: build_only: true diff --git a/app/samples/sensor/sample.yaml b/app/samples/sensor/sample.yaml index d4f09450c..c366c18b9 100644 --- a/app/samples/sensor/sample.yaml +++ b/app/samples/sensor/sample.yaml @@ -1,5 +1,5 @@ sample: - description: + description: sensor name: sensor common: build_only: true diff --git a/app/samples/shield_blinky/sample.yaml b/app/samples/shield_blinky/sample.yaml index af5939ba3..2d8656728 100644 --- a/app/samples/shield_blinky/sample.yaml +++ b/app/samples/shield_blinky/sample.yaml @@ -1,5 +1,5 @@ sample: - description: + description: shield_blinky name: shield_blinky common: build_only: true diff --git a/app/samples/shield_mcp3561r/sample.yaml b/app/samples/shield_mcp3561r/sample.yaml index 9c9d16e19..772b1c2c9 100644 --- a/app/samples/shield_mcp3561r/sample.yaml +++ b/app/samples/shield_mcp3561r/sample.yaml @@ -1,5 +1,5 @@ sample: - description: + description: shield_blinky name: shield_blinky common: build_only: true diff --git a/app/samples/sntp_client/sample.yaml b/app/samples/sntp_client/sample.yaml index 18e9ce154..48b84dd51 100644 --- a/app/samples/sntp_client/sample.yaml +++ b/app/samples/sntp_client/sample.yaml @@ -1,5 +1,5 @@ sample: - description: + description: sntp-client name: sntp-client common: build_only: true diff --git a/app/samples/soft_timer/sample.yaml b/app/samples/soft_timer/sample.yaml index e1d6130e6..55bf7f4eb 100644 --- a/app/samples/soft_timer/sample.yaml +++ b/app/samples/soft_timer/sample.yaml @@ -1,5 +1,5 @@ sample: - description: + description: soft-timer name: soft-timer common: build_only: true diff --git a/app/samples/tenants_and_tasks/sample.yaml b/app/samples/tenants_and_tasks/sample.yaml index 46382fab0..610ee107c 100644 --- a/app/samples/tenants_and_tasks/sample.yaml +++ b/app/samples/tenants_and_tasks/sample.yaml @@ -1,5 +1,5 @@ sample: - description: + description: tenants-and-tasks name: tenants-and-tasks common: build_only: true diff --git a/app/samples/tftp_server/sample.yaml b/app/samples/tftp_server/sample.yaml index a0f662e3b..323087c9b 100644 --- a/app/samples/tftp_server/sample.yaml +++ b/app/samples/tftp_server/sample.yaml @@ -1,5 +1,5 @@ sample: - description: + description: tftp-server name: tftp-server common: build_only: true diff --git a/app/samples/time_travel/sample.yaml b/app/samples/time_travel/sample.yaml index 07566857f..ac4144994 100644 --- a/app/samples/time_travel/sample.yaml +++ b/app/samples/time_travel/sample.yaml @@ -1,5 +1,5 @@ sample: - description: + description: time-travel name: time-travel common: build_only: true diff --git a/app/samples/udp_bcast/sample.yaml b/app/samples/udp_bcast/sample.yaml index 9785820af..08f2eb08b 100644 --- a/app/samples/udp_bcast/sample.yaml +++ b/app/samples/udp_bcast/sample.yaml @@ -1,5 +1,5 @@ sample: - description: + description: udp-bcast name: udp-bcast common: build_only: true diff --git a/app/samples/udp_rcv/sample.yaml b/app/samples/udp_rcv/sample.yaml index 958c322c1..bafbbdc74 100644 --- a/app/samples/udp_rcv/sample.yaml +++ b/app/samples/udp_rcv/sample.yaml @@ -1,5 +1,5 @@ sample: - description: + description: udp-rcv name: udp-rcv common: build_only: true diff --git a/drivers/sensor/openrocket/barometer/CMakeLists.txt b/drivers/sensor/openrocket/barometer/CMakeLists.txt index 9453e4c32..97d573405 100644 --- a/drivers/sensor/openrocket/barometer/CMakeLists.txt +++ b/drivers/sensor/openrocket/barometer/CMakeLists.txt @@ -5,4 +5,5 @@ # zephyr_library() +zephyr_include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include) zephyr_library_sources(openrocket_barom.c) diff --git a/drivers/sensor/openrocket/gnss/CMakeLists.txt b/drivers/sensor/openrocket/gnss/CMakeLists.txt index 3994674f2..0774d9030 100644 --- a/drivers/sensor/openrocket/gnss/CMakeLists.txt +++ b/drivers/sensor/openrocket/gnss/CMakeLists.txt @@ -5,4 +5,5 @@ # zephyr_library() +zephyr_include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include) zephyr_library_sources(openrocket_gnss.c) diff --git a/drivers/sensor/openrocket/imu/CMakeLists.txt b/drivers/sensor/openrocket/imu/CMakeLists.txt index 5f78f3dc3..f0140c5c3 100644 --- a/drivers/sensor/openrocket/imu/CMakeLists.txt +++ b/drivers/sensor/openrocket/imu/CMakeLists.txt @@ -5,4 +5,5 @@ # zephyr_library() +zephyr_include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include) zephyr_library_sources(openrocket_imu.c) diff --git a/drivers/sensor/openrocket/magnetometer/CMakeLists.txt b/drivers/sensor/openrocket/magnetometer/CMakeLists.txt index 9dde82bd9..be5e8493c 100644 --- a/drivers/sensor/openrocket/magnetometer/CMakeLists.txt +++ b/drivers/sensor/openrocket/magnetometer/CMakeLists.txt @@ -5,4 +5,5 @@ # zephyr_library() +zephyr_include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include) zephyr_library_sources(openrocket_magnetometer.c) diff --git a/include/f_core/net/application/c_sntp_server_tenant.h b/include/f_core/net/application/c_sntp_server_tenant.h index 57b88a155..0a3d4aab4 100644 --- a/include/f_core/net/application/c_sntp_server_tenant.h +++ b/include/f_core/net/application/c_sntp_server_tenant.h @@ -159,7 +159,7 @@ class CSntpServerTenant : public CCallbackTenant { int getLastUpdateTimeAsSeconds(uint32_t& seconds); - uint32_t reckonAndByteSwapTimestamp(uint32_t timestamp) { return htonl(timestamp + OFFSET_1970_JAN_1); } + uint32_t reckonAndByteSwapTimestamp(uint32_t timestamp) { return net_htonl(timestamp + OFFSET_1970_JAN_1); } void setupRtcTime(); }; diff --git a/include/f_core/net/application/c_tftp_server_tenant.h b/include/f_core/net/application/c_tftp_server_tenant.h index 3b49f6ab8..938889235 100644 --- a/include/f_core/net/application/c_tftp_server_tenant.h +++ b/include/f_core/net/application/c_tftp_server_tenant.h @@ -89,7 +89,7 @@ class CTftpServerTenant : public CCallbackTenant { * @param packet Packet data * @param len Length of the packet */ - void handleReadRequest(const sockaddr &srcAddr, const uint8_t *packet, int len); + void handleReadRequest(const struct sockaddr& srcAddr, const uint8_t* packet, int len); /** * Wait for acknowledgement from the client @@ -98,7 +98,7 @@ class CTftpServerTenant : public CCallbackTenant { * @param blockNum Block number to wait for * @return 0 on success, negative error code on failure */ - int waitForAck(CUdpSocket &dataSock, const sockaddr &srcAddr, uint16_t blockNum); + int waitForAck(CUdpSocket& dataSock, const struct sockaddr& srcAddr, uint16_t blockNum); /** * Non-standard TFTP function for generating a filesystem tree diff --git a/include/f_core/net/network/c_ipv4.h b/include/f_core/net/network/c_ipv4.h index 7e448a1ec..07b8ed957 100644 --- a/include/f_core/net/network/c_ipv4.h +++ b/include/f_core/net/network/c_ipv4.h @@ -1,6 +1,8 @@ #pragma once -#include +#include +#include +#include struct net_if; // Forward declaration struct device; @@ -39,7 +41,7 @@ class CIPv4 { * Getter for address structure * @return Address structure */ - [[nodiscard]] in_addr GetAddr() const { return addr; } + [[nodiscard]] struct in_addr GetAddr() const { return addr; } /** * Getter for error code from initialization @@ -56,7 +58,7 @@ class CIPv4 { private: const char* ip; net_if& netIface; - in_addr addr{}; + struct in_addr addr{}; int err = 0; int initialize(); diff --git a/include/f_core/net/transport/c_udp_socket.h b/include/f_core/net/transport/c_udp_socket.h index fa3d622bf..988791748 100644 --- a/include/f_core/net/transport/c_udp_socket.h +++ b/include/f_core/net/transport/c_udp_socket.h @@ -6,6 +6,7 @@ #include #include #include +#include class CIPv4; @@ -45,7 +46,8 @@ class CUdpSocket { * @param[in] srcAddrLen Optional source address length * @return Number of bytes received or negative error code */ - int ReceiveSynchronous(void* data, size_t len, sockaddr* srcAddr = nullptr, socklen_t* srcAddrLen = nullptr); + int ReceiveSynchronous(void* data, size_t len, struct sockaddr* srcAddr = nullptr, + socklen_t* srcAddrLen = nullptr); /** * Transmit data asynchronously @@ -68,7 +70,8 @@ class CUdpSocket { /** * See parent docs */ - int ReceiveAsynchronous(void* data, size_t len, sockaddr* srcAddr = nullptr, socklen_t* srcAddrLen = nullptr); + int ReceiveAsynchronous(void* data, size_t len, struct sockaddr* srcAddr = nullptr, + socklen_t* srcAddrLen = nullptr); /** * Set transmit timeout diff --git a/lib/f_core/net/application/c_sntp_server_tenant.cpp b/lib/f_core/net/application/c_sntp_server_tenant.cpp index e43c647b4..4065def80 100644 --- a/lib/f_core/net/application/c_sntp_server_tenant.cpp +++ b/lib/f_core/net/application/c_sntp_server_tenant.cpp @@ -75,7 +75,7 @@ void CSntpServerTenant::Callback() { uint32_t rxPacketSecondsTimestamp = 0; uint32_t txPacketSecondsTimestamp = 0; uint32_t lastUpdateTimeSeconds = 0; - sockaddr srcAddr = {0}; + struct sockaddr srcAddr = {0}; socklen_t srcAddrLen = sizeof(srcAddr); const int rxLen = sock.ReceiveAsynchronous(&clientPacket, sizeof(clientPacket), &srcAddr, &srcAddrLen); @@ -116,7 +116,7 @@ void CSntpServerTenant::Callback() { .poll = pollInterval, .precision = precisionExponent, .rootDelay = 0, // Unknown, but very small with the assumption Ethernet is used - .rootDispersion = htonl(GNSS_ROOT_DISPERSION_FIXED_POINT), // 0.5 ms + .rootDispersion = net_htonl(GNSS_ROOT_DISPERSION_FIXED_POINT), // 0.5 ms .refTimestampSeconds = reckonAndByteSwapTimestamp(lastUpdateTimeSeconds), .refTimestampFraction = 0, .originateTimestampSeconds = clientPacket.txTimestampSeconds, @@ -129,7 +129,7 @@ void CSntpServerTenant::Callback() { memcpy(packet.referenceId, GPS_REFERENCE_CODE, 4); sockaddr_in clientAddr = *reinterpret_cast(&srcAddr); - uint16_t clientPort = ntohs(clientAddr.sin_port); + uint16_t clientPort = net_ntohs(clientAddr.sin_port); sock.SetDstPort(clientPort); int ret = sock.TransmitAsynchronous(&packet, sizeof(packet)); diff --git a/lib/f_core/net/application/c_tftp_server_tenant.cpp b/lib/f_core/net/application/c_tftp_server_tenant.cpp index a9e9e5163..53fade824 100644 --- a/lib/f_core/net/application/c_tftp_server_tenant.cpp +++ b/lib/f_core/net/application/c_tftp_server_tenant.cpp @@ -11,9 +11,9 @@ LOG_MODULE_REGISTER(CTftpServerTenant); -char *inet_ntoa(in_addr in) { +char* inet_ntoa(struct in_addr in) { static char buf[INET_ADDRSTRLEN]; - unsigned char *bytes = (unsigned char *) &in.s_addr; + unsigned char* bytes = (unsigned char*)&in.s_addr; snprintf(buf, sizeof(buf), "%d.%d.%d.%d", bytes[0], bytes[1], bytes[2], bytes[3]); @@ -50,7 +50,7 @@ void CTftpServerTenant::Register() { void CTftpServerTenant::Cleanup() {} void CTftpServerTenant::Callback() { - sockaddr srcAddr = {0}; + struct sockaddr srcAddr = {0}; socklen_t srcAddrLen = sizeof(srcAddr); uint8_t packet[rwRequestPacketSize] = {0}; int rxLen = sock.ReceiveAsynchronous(packet, rwRequestPacketSize, &srcAddr, &srcAddrLen); @@ -73,14 +73,14 @@ void CTftpServerTenant::Callback() { } } -int CTftpServerTenant::waitForAck(CUdpSocket &dataSock, const sockaddr &srcAddr, uint16_t blockNum) { +int CTftpServerTenant::waitForAck(CUdpSocket& dataSock, const struct sockaddr& srcAddr, uint16_t blockNum) { static constexpr uint16_t ackPktSize = 4; uint8_t ack[ackPktSize] = {0}; // 2 bytes for opcode, 2 for block number const int maxRetries = 5; int retries = 0; while (retries < maxRetries) { - int ret = dataSock.ReceiveAsynchronous(ack, 4, const_cast(&srcAddr), nullptr); + int ret = dataSock.ReceiveAsynchronous(ack, 4, const_cast(&srcAddr), nullptr); if (ret < 0) { // If no data available yet, wait and retry. if (errno == EWOULDBLOCK || errno == EAGAIN) { @@ -108,7 +108,7 @@ int CTftpServerTenant::waitForAck(CUdpSocket &dataSock, const sockaddr &srcAddr, return -1; } -void CTftpServerTenant::handleReadRequest(const sockaddr &clientAddr, const uint8_t *packet, int len) { +void CTftpServerTenant::handleReadRequest(const struct sockaddr& clientAddr, const uint8_t* packet, int len) { static constexpr uint16_t maxFilenameLen = rwRequestPacketSize - strlen(tftpModeStrings[NETASCII]) + 4; // 4 for opcode and both zero terminators const char *filename = reinterpret_cast(&packet[2]); diff --git a/lib/f_core/net/network/c_ipv4.cpp b/lib/f_core/net/network/c_ipv4.cpp index 46ff8577c..addf03bdf 100644 --- a/lib/f_core/net/network/c_ipv4.cpp +++ b/lib/f_core/net/network/c_ipv4.cpp @@ -14,9 +14,9 @@ CIPv4::CIPv4(const char* ip) : CIPv4(ip, net_if_get_default()) {}; CIPv4::CIPv4(const char* ip, const device* dev) : CIPv4(ip, net_if_lookup_by_dev(dev)) {}; int CIPv4::initialize() { - in_addr subnet{}; + struct in_addr subnet{}; - err = z_impl_net_addr_pton(AF_INET, ip, &addr); + err = net_addr_pton(AF_INET, ip, &addr); if (err < 0) { LOG_ERR("Invalid IP address"); return err; @@ -28,7 +28,7 @@ int CIPv4::initialize() { return -ENODEV; } - err = z_impl_net_addr_pton(AF_INET, CLASS_A_NETMASK, &subnet); + err = net_addr_pton(AF_INET, CLASS_A_NETMASK, &subnet); if (err < 0) { LOG_ERR("Invalid subnet mask"); return err; @@ -40,4 +40,4 @@ int CIPv4::initialize() { LOG_DBG("Initialized IPv4 address %s", ip); return 0; -} \ No newline at end of file +} diff --git a/lib/f_core/net/transport/c_udp_socket.cpp b/lib/f_core/net/transport/c_udp_socket.cpp index 38db4763e..b7d923de3 100644 --- a/lib/f_core/net/transport/c_udp_socket.cpp +++ b/lib/f_core/net/transport/c_udp_socket.cpp @@ -27,7 +27,7 @@ CUdpSocket::CUdpSocket(const CIPv4& ipv4, uint16_t srcPort, uint16_t dstPort) : .sin_addr = INADDR_ANY // Bind to all interfaces TODO: Might not need ipv4 variable anymore }; - if (zsock_bind(sockfd.fd, reinterpret_cast(&addr), sizeof(addr)) < 0) { + if (zsock_bind(sockfd.fd, reinterpret_cast(&addr), sizeof(addr)) < 0) { LOG_ERR("Failed to bind socket: %d", errno); zsock_close(sockfd.fd); sockfd.fd = -1; @@ -53,14 +53,14 @@ CUdpSocket::~CUdpSocket() { } int CUdpSocket::TransmitSynchronous(const void* data, size_t len) { - const sockaddr_in addr{ + sockaddr_in addr{ .sin_family = AF_INET, .sin_port = htons(dstPort), }; - z_impl_net_addr_pton(AF_INET, BROADCAST_IP, const_cast(&addr.sin_addr)); + net_addr_pton(AF_INET, BROADCAST_IP, &addr.sin_addr); - int ret = zsock_sendto(sockfd.fd, data, len, 0, reinterpret_cast(&addr), sizeof(addr)); + int ret = zsock_sendto(sockfd.fd, data, len, 0, reinterpret_cast(&addr), sizeof(addr)); if (ret < 0) { LOG_ERR("Failed to send broadcast message (%d)", errno); } @@ -68,14 +68,14 @@ int CUdpSocket::TransmitSynchronous(const void* data, size_t len) { return ret; } -int CUdpSocket::ReceiveSynchronous(void* data, size_t len, sockaddr* srcAddr, socklen_t* srcAddrLen) { +int CUdpSocket::ReceiveSynchronous(void* data, size_t len, struct sockaddr* srcAddr, socklen_t* srcAddrLen) { return zsock_recvfrom(sockfd.fd, data, len, 0, srcAddr, srcAddrLen); } int CUdpSocket::TransmitAsynchronous(const void* data, size_t len) { return TransmitAsynchronous(data, len, dstPort); } int CUdpSocket::TransmitAsynchronous(const void* data, size_t len, uint16_t dstPort) { - const sockaddr_in addr{ + sockaddr_in addr{ .sin_family = AF_INET, .sin_port = htons(dstPort), }; @@ -93,8 +93,8 @@ int CUdpSocket::TransmitAsynchronous(const void* data, size_t len, uint16_t dstP } } - z_impl_net_addr_pton(AF_INET, BROADCAST_IP, const_cast(&addr.sin_addr)); - int ret = zsock_sendto(sockfd.fd, data, len, 0, reinterpret_cast(&addr), sizeof(addr)); + net_addr_pton(AF_INET, BROADCAST_IP, &addr.sin_addr); + int ret = zsock_sendto(sockfd.fd, data, len, 0, reinterpret_cast(&addr), sizeof(addr)); if (ret < 0 && errno != EWOULDBLOCK && errno != EAGAIN) { LOG_ERR("Failed to send async message (%d)", errno); } @@ -102,7 +102,7 @@ int CUdpSocket::TransmitAsynchronous(const void* data, size_t len, uint16_t dstP return ret; } -int CUdpSocket::ReceiveAsynchronous(void* data, size_t len, sockaddr* srcAddr, socklen_t* srcAddrLen) { +int CUdpSocket::ReceiveAsynchronous(void* data, size_t len, struct sockaddr* srcAddr, socklen_t* srcAddrLen) { int flags = zsock_fcntl(sockfd.fd, F_GETFL, 0); if (flags < 0) { LOG_ERR("Failed to get socket flags (%d)", flags); diff --git a/lib/f_core/radio/frame_handlers/c_frequency_change_handler.cpp b/lib/f_core/radio/frame_handlers/c_frequency_change_handler.cpp index 08c16652b..9d8253bd5 100644 --- a/lib/f_core/radio/frame_handlers/c_frequency_change_handler.cpp +++ b/lib/f_core/radio/frame_handlers/c_frequency_change_handler.cpp @@ -2,8 +2,8 @@ #include "zephyr/logging/log.h" -#include #include +#include LOG_MODULE_REGISTER(CFrequencyChangeHandler); @@ -16,7 +16,7 @@ void CFrequencyChangeHandler::HandleFrame(const ReceivedLaunchLoraFrame& rxFrame uint32_t freqNetworkOrder = 0; memcpy(&freqNetworkOrder, frame.Payload, sizeof(freqNetworkOrder)); - const uint32_t freqHz = ntohl(freqNetworkOrder); + const uint32_t freqHz = net_ntohl(freqNetworkOrder); const float freqMhz = static_cast(freqHz) / 1'000'000.0f; LOG_INF("Changing frequency to %f MHz", static_cast(freqMhz)); diff --git a/lib/f_core/radio/frame_handlers/c_lora_freq_request_tenant.cpp b/lib/f_core/radio/frame_handlers/c_lora_freq_request_tenant.cpp index 9d70dc2b6..3ee0297d2 100644 --- a/lib/f_core/radio/frame_handlers/c_lora_freq_request_tenant.cpp +++ b/lib/f_core/radio/frame_handlers/c_lora_freq_request_tenant.cpp @@ -1,9 +1,9 @@ #include "f_core/radio/frame_handlers/c_lora_freq_request_tenant.h" -#include #include #include #include +#include LOG_MODULE_REGISTER(CLoraFreqRequestTenant); @@ -101,7 +101,7 @@ bool CLoraFreqRequestTenant::receiveCommand(uint32_t& freqHz) { return false; } - const uint32_t hostOrder = ntohl(networkOrder); + const uint32_t hostOrder = net_ntohl(networkOrder); float freqMhz = 0.0f; memcpy(&freqMhz, &hostOrder, sizeof(freqMhz)); @@ -121,7 +121,7 @@ bool CLoraFreqRequestTenant::sendFrequencyCommand(const uint32_t freqHz) { frame.Port = commandUdpPort; frame.Size = sizeof(uint32_t); - const uint32_t networkOrder = htonl(freqHz); + const uint32_t networkOrder = net_htonl(freqHz); memcpy(frame.Payload, &networkOrder, sizeof(networkOrder)); const int ret = downlinkMessagePort.Send(frame, K_NO_WAIT);