ofono_netreg_strength_notify(netreg, msg[1]);
}
+static void time_ind_cb(GIsiClient *client, const void *restrict data,
+ size_t len, uint16_t object, void *opaque)
+{
+ const unsigned char *msg = data;
+ const unsigned char *nitz = msg + 3;
+ struct ofono_netreg *netreg = opaque;
+
+ struct ofono_network_time info;
+
+ if (!msg || len < 13 || msg[0] != NET_TIME_IND
+ || nitz[0] != NET_TIME_INFO)
+ return;
+
+ nitz += 2;
+
+ /* Value is years since last turn of century */
+ info.year = nitz[0] != NET_INVALID_TIME ? nitz[0] : -1;
+ info.year += 2000;
+
+ info.mon = nitz[1] != NET_INVALID_TIME ? nitz[1] : -1;
+ info.mday = nitz[2] != NET_INVALID_TIME ? nitz[2] : -1;
+ info.hour = nitz[3] != NET_INVALID_TIME ? nitz[3] : -1;
+ info.min = nitz[4] != NET_INVALID_TIME ? nitz[4] : -1;
+ info.sec = nitz[5] != NET_INVALID_TIME ? nitz[5] : -1;
+
+ /* Most significant bit set indicates negative offset. The
+ * second most significant bit is 'reserved'. The value is the
+ * offset from UTCin a count of 15min intervals, possibly
+ * including the current DST adjustment. */
+ info.utcoff = (nitz[6] & 0x3F) * 15 * 60;
+ if (nitz[6] & 0x80)
+ info.utcoff *= -1;
+
+ info.dst = nitz[7] != NET_INVALID_TIME ? nitz[7] : -1;
+
+ ofono_netreg_time_notify(netreg, &info);
+}
+
static bool rssi_resp_cb(GIsiClient *client, const void *restrict data,
size_t len, uint16_t object, void *opaque)
{
g_isi_subscribe(nd->client, NET_REG_STATUS_IND, reg_status_ind_cb,
netreg);
g_isi_subscribe(nd->client, NET_RAT_IND, rat_ind_cb, netreg);
+ g_isi_subscribe(nd->client, NET_TIME_IND, time_ind_cb, netreg);
/* Bootstrap current RAT setting */
if (!g_isi_request_make(nd->client, rat, sizeof(rat),
#define NETWORK_TIMEOUT 5
#define NETWORK_SCAN_TIMEOUT 180
#define NETWORK_SET_TIMEOUT 240
+#define NET_INVALID_TIME 0x64
enum net_message_id {
NET_SET_REQ = 0x07,
NET_RSSI_GET_REQ = 0x0B,
NET_RSSI_GET_RESP = 0x0C,
NET_RSSI_IND = 0x1E,
+ NET_TIME_IND = 0x27,
NET_RAT_IND = 0x35,
NET_RAT_REQ = 0x36,
NET_RAT_RESP = 0x37,
NET_GSM_REG_INFO = 0x09,
NET_DETAILED_NETWORK_INFO = 0x0B,
NET_GSM_OPERATOR_INFO = 0x0C,
+ NET_TIME_INFO = 0x10,
NET_GSM_BAND_INFO = 0x11,
NET_RAT_INFO = 0x2C,
NET_AVAIL_NETWORK_INFO_COMMON = 0xE1,