Skip to content

Commit 0530284

Browse files
committed
modem: ubx: Change request buffer to be uint8_t
So this API can be used to send frames with a different encoding than UBX. This enables UBX drivers to send RTCM3 correction frames using UBX API, without having to switch over modem pipes. Signed-off-by: Luis Ubieda <luisf@croxel.com>
1 parent 366d03c commit 0530284

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

drivers/gnss/gnss_u_blox_f9p.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ static int ubx_f9p_msg_get(const struct device *dev, const struct ubx_frame *req
122122
data->script.inst.retry_count = 2;
123123
data->script.inst.match.filter.class = req->class;
124124
data->script.inst.match.filter.id = req->id;
125-
data->script.inst.request.buf = req;
125+
data->script.inst.request.buf = (const uint8_t *)req;
126126
data->script.inst.request.len = len;
127127

128128
err = modem_ubx_run_script(&data->ubx.inst, &data->script.inst);
@@ -153,7 +153,7 @@ static int ubx_f9p_msg_send(const struct device *dev, const struct ubx_frame *re
153153
data->script.inst.retry_count = wait_for_ack ? 2 : 0;
154154
data->script.inst.match.filter.class = wait_for_ack ? UBX_CLASS_ID_ACK : 0;
155155
data->script.inst.match.filter.id = UBX_MSG_ID_ACK;
156-
data->script.inst.request.buf = req;
156+
data->script.inst.request.buf = (const uint8_t *)req;
157157
data->script.inst.request.len = len;
158158

159159
err = modem_ubx_run_script(&data->ubx.inst, &data->script.inst);

drivers/gnss/gnss_u_blox_m8.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ static int ubx_m8_msg_get(const struct device *dev, const struct ubx_frame *req,
121121
data->script.inst.retry_count = 2;
122122
data->script.inst.match.filter.class = req->class;
123123
data->script.inst.match.filter.id = req->id;
124-
data->script.inst.request.buf = req;
124+
data->script.inst.request.buf = (const uint8_t *)req;
125125
data->script.inst.request.len = len;
126126

127127
err = modem_ubx_run_script(&data->ubx.inst, &data->script.inst);
@@ -153,7 +153,7 @@ static int ubx_m8_msg_send(const struct device *dev, const struct ubx_frame *req
153153
data->script.inst.retry_count = wait_for_ack ? 2 : 0;
154154
data->script.inst.match.filter.class = wait_for_ack ? UBX_CLASS_ID_ACK : 0;
155155
data->script.inst.match.filter.id = UBX_MSG_ID_ACK;
156-
data->script.inst.request.buf = req;
156+
data->script.inst.request.buf = (const uint8_t *)req;
157157
data->script.inst.request.len = len;
158158

159159
err = modem_ubx_run_script(&data->ubx.inst, &data->script.inst);

include/zephyr/modem/ubx.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ struct modem_ubx_match {
5353

5454
struct modem_ubx_script {
5555
struct {
56-
const struct ubx_frame *buf;
56+
const uint8_t *buf;
5757
uint16_t len;
5858
} request;
5959
struct {

tests/subsys/modem/modem_ubx/src/main.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ static inline void restore_ubx_script(void)
9494
const struct script_runner script_runner_restored = {
9595
.script = {
9696
.request = {
97-
.buf = &test_req,
97+
.buf = (const uint8_t *)&test_req,
9898
.len = UBX_FRAME_SZ(frame_restored.payload_size),
9999
},
100100
.match = MODEM_UBX_MATCH_DEFINE(UBX_CLASS_ID_ACK, UBX_MSG_ID_ACK, NULL),
@@ -236,7 +236,7 @@ ZTEST(modem_ubx, test_script_is_thread_safe)
236236
struct script_runner script_runner_1 = {
237237
.script = {
238238
.request = {
239-
.buf = &test_req,
239+
.buf = (const uint8_t *)&test_req,
240240
.len = UBX_FRAME_SZ(test_req.payload_size),
241241
},
242242
.match = MODEM_UBX_MATCH_DEFINE(UBX_CLASS_ID_ACK, UBX_MSG_ID_ACK, NULL),
@@ -250,7 +250,7 @@ ZTEST(modem_ubx, test_script_is_thread_safe)
250250
struct script_runner script_runner_2 = {
251251
.script = {
252252
.request = {
253-
.buf = &test_req,
253+
.buf = (const uint8_t *)&test_req,
254254
.len = UBX_FRAME_SZ(test_req.payload_size),
255255
},
256256
.match = MODEM_UBX_MATCH_DEFINE(UBX_CLASS_ID_ACK, UBX_MSG_ID_ACK, NULL),

0 commit comments

Comments
 (0)