summaryrefslogtreecommitdiffstats
path: root/gisi
diff options
context:
space:
mode:
authorAki Niemi <aki.niemi@nokia.com>2011-02-04 14:58:04 +0200
committerAki Niemi <aki.niemi@nokia.com>2011-02-07 09:51:35 +0200
commit090dc92b68c89f51da8aae7c0367cd6373494bf3 (patch)
tree23bacf96650be14b240dd4bed100f94faf388b24 /gisi
parentd957dbece5f8290c3f3ee05d8eab026f4419271a (diff)
downloadofono-090dc92b68c89f51da8aae7c0367cd6373494bf3.tar.bz2
gisi: Refactor indication subscriptions
Handle different message types for IND subscriptions based on the presence of the GISI_MODEM_FLAG_USE_LEGACY_SUBSCRIBE flag. This enables building modem plugins for modems that only support one or the other available IND types. Based on patches from: Jessica Nilsson <jessica.j.nilsson@stericsson.com>
Diffstat (limited to 'gisi')
-rw-r--r--gisi/common.h1
-rw-r--r--gisi/modem.c27
2 files changed, 21 insertions, 7 deletions
diff --git a/gisi/common.h b/gisi/common.h
index cadd3f42..a29e6fa0 100644
--- a/gisi/common.h
+++ b/gisi/common.h
@@ -35,6 +35,7 @@ enum message_id {
PNS_NAME_ADD_REQ = 0x05,
PNS_NAME_REMOVE_REQ = 0x07,
PNS_SUBSCRIBED_RESOURCES_IND = 0x10,
+ PNS_SUBSCRIBED_RESOURCES_EXTEND_IND = 0x12,
COMM_ISI_VERSION_GET_REQ = 0x12,
COMM_ISI_VERSION_GET_RESP = 0x13,
COMM_ISA_ENTITY_NOT_REACHABLE_RESP = 0x14,
diff --git a/gisi/modem.c b/gisi/modem.c
index 9caa2a96..f745bb2b 100644
--- a/gisi/modem.c
+++ b/gisi/modem.c
@@ -341,16 +341,21 @@ static gboolean modem_subs_update(gpointer data)
gpointer keyptr, value;
GIsiModem *modem = data;
+ gboolean legacy = modem->flags & GISI_MODEM_FLAG_USE_LEGACY_SUBSCRIBE;
struct sockaddr_pn commgr = {
.spn_family = AF_PHONET,
.spn_resource = PN_COMMGR,
.spn_dev = modem->device,
};
- uint8_t msg[3 + 256] = {
- 0, PNS_SUBSCRIBED_RESOURCES_IND,
- 0,
+ uint8_t msg[4 + 1024] = {
+ 0, /* UTID */
+ legacy ? PNS_SUBSCRIBED_RESOURCES_IND :
+ PNS_SUBSCRIBED_RESOURCES_EXTEND_IND,
+ 0, /* Count */
+ 0, /* Filler */
};
uint8_t count = 0;
+ size_t len;
modem->subs_source = 0;
@@ -359,14 +364,22 @@ static gboolean modem_subs_update(gpointer data)
while (g_hash_table_iter_next(&iter, &keyptr, &value)) {
GIsiServiceMux *mux = value;
- if (mux->subscriptions > 0) {
+ if (mux->subscriptions == 0)
+ continue;
+
+ if (legacy)
msg[3 + count] = mux->resource;
- count++;
- }
+ else
+ /* Resource field is 32bit and Little-endian */
+ msg[4 + count * 4 + 3] = mux->resource;
+
+ count++;
}
+
+ len = legacy ? 3 + count : 4 + count * 4;
msg[2] = count;
- sendto(modem->ind_fd, msg, 3 + msg[2], MSG_NOSIGNAL, (void *)&commgr,
+ sendto(modem->ind_fd, msg, len, MSG_NOSIGNAL, (void *) &commgr,
sizeof(commgr));
return FALSE;