From ef4b7fbeafe225a4c04c62461cb6952540f8a94c Mon Sep 17 00:00:00 2001 From: Aki Niemi Date: Fri, 31 Dec 2010 14:48:59 +0200 Subject: [PATCH] gisi: Add API for one-shot sending of messages --- gisi/modem.c | 23 +++++++++++++++++++++++ gisi/modem.h | 7 +++++++ 2 files changed, 30 insertions(+) diff --git a/gisi/modem.c b/gisi/modem.c index 8288290..0682666 100644 --- a/gisi/modem.c +++ b/gisi/modem.c @@ -911,6 +911,29 @@ int g_isi_response_vsend(GIsiModem *modem, const GIsiMessage *req, return g_isi_modem_vsendto(modem, req->addr, _iov, 1 + iovlen); } +int g_isi_modem_send(GIsiModem *modem, uint8_t resource, + const void *__restrict buf, size_t len) +{ + struct sockaddr_pn dst = { + .spn_family = AF_PHONET, + .spn_resource = resource, + }; + + return g_isi_modem_sendto(modem, &dst, buf, len); +} + +int g_isi_modem_vsend(GIsiModem *modem, uint8_t resource, + const struct iovec *__restrict iov, + size_t iovlen) +{ + struct sockaddr_pn dst = { + .spn_family = AF_PHONET, + .spn_resource = resource, + }; + + return g_isi_modem_vsendto(modem, &dst, iov, iovlen); +} + int g_isi_modem_sendto(GIsiModem *modem, struct sockaddr_pn *dst, const void *__restrict buf, size_t len) { diff --git a/gisi/modem.h b/gisi/modem.h index 7ff4d72..fff1338 100644 --- a/gisi/modem.h +++ b/gisi/modem.h @@ -72,6 +72,13 @@ GIsiPending *g_isi_request_vsendto(GIsiModem *modem, struct sockaddr_pn *dst, GIsiNotifyFunc notify, void *data, GDestroyNotify destroy); +int g_isi_modem_send(GIsiModem *modem, uint8_t resource, + const void *__restrict buf, size_t len); + +int g_isi_modem_vsend(GIsiModem *modem, uint8_t resource, + const struct iovec *__restrict iov, + size_t iovlen); + int g_isi_modem_sendto(GIsiModem *modem, struct sockaddr_pn *dst, const void *__restrict buf, size_t len); -- 2.7.4