Add CNAP support (callerid name presentation) to isimodem
PATCH 1/1 Add CNAP support (callerid name presentation) to isimodem
--- drivers/isimodem/voicecall.c | 39 ++++++++++++++++++++++++++++++++++++++- src/voicecall.c | 4 ++-- 2 files changed, 40 insertions(+), 3 deletions(-)
drivers/isimodem/voicecall.c +38 -1
@@ -56,8 +56,10 @@ struct isi_call {uint8_t cause;uint8_t addr_type;uint8_t presentation; +uint8_t name_presentation;uint8_t reason;char address[20 ]; +char name[20 ];char addr_pad[4 ]; };
@@ -231,6 +233,7 @@ static void isi_call_origin_address_sb_proc(struct isi_voicecall *ivc,isi_call_any_address_sb_proc (ivc, call, sb); } +static void isi_call_destination_address_sb_proc (struct isi_voicecall *ivc,struct isi_call *call,GIsiSubBlockIter *sb)
@@ -239,6 +242,29 @@ static void isi_call_destination_address_sb_proc(struct isi_voicecall *ivc,isi_call_any_address_sb_proc (ivc, call, sb); } +static void isi_call_origin_info_sb_proc (struct isi_voicecall *ivc, +struct isi_call *call, +GIsiSubBlockIter *sb) +{ +uint8_t pres; +uint8_t id; +uint8_t len; +char *name; + +if (!g_isi_sb_iter_get_byte (sb, &pres,2 ) || + !g_isi_sb_iter_get_byte (sb, &id,6 ) || + !g_isi_sb_iter_get_byte (sb, &len,7 ) || + !g_isi_sb_iter_get_alpha_tag (sb, &name,2 * len,8 )) +return ; + + +DBG ("Got name %s" , name); + call->name_presentation = pres; +strncpy (call->name, name,sizeof (call->name)); + +g_free (name); +} +static void isi_call_mode_sb_proc (struct isi_voicecall *ivc,struct isi_call *call,GIsiSubBlockIter *sb)
@@ -396,13 +422,19 @@ static struct ofono_call isi_call_as_ofono_call(const struct isi_call *call) ocall.status =isi_call_status_to_clcc (call);memcpy (number->number, call->address,sizeof (number->number)); +memcpy (ocall.name, call->name,sizeof (ocall.name)); + number->type =0x80 | call->addr_type; ocall.clip_validity = call->presentation &3 ; + ocall.cnap_validity = call->name_presentation &3 ;if (ocall.clip_validity ==0 &&strlen (number->number) ==0 ) ocall.clip_validity =2 ; +if (ocall.cnap_validity ==0 &&strlen (call->name) ==0 ) + ocall.cnap_validity =2 ; +return ocall; }
@@ -513,11 +545,12 @@ static void isi_call_notify(struct ofono_voicecall *ovc, struct isi_call *call) ocall =isi_call_as_ofono_call (call); -DBG ("id=%u,%s,%u,\"%s\",%u,%u" , +DBG ("id=%u,%s,%u,\"%s\",\"%s\",%u,%u" , ocall.id, ocall.direction ?"terminated" :"originated" , ocall.status, ocall.phone_number.number, + ocall.name, ocall.phone_number.type, ocall.clip_validity);
@@ -622,6 +655,10 @@ static void isi_call_status_ind_cb(const GIsiMessage *msg, void *data)isi_call_origin_address_sb_proc (ivc, call, &iter);break ; +case CALL_ORIGIN_INFO : +isi_call_origin_info_sb_proc (ivc, call, &iter); +break ; +case CALL_GSM_DETAILED_CAUSE :case CALL_DESTINATION_PRE_ADDRESS :case CALL_DESTINATION_POST_ADDRESS :
src/voicecall.c +2 -2
@@ -1951,8 +1951,8 @@ void ofono_voicecall_notify(struct ofono_voicecall *vc,struct ofono_call *newcall;DBG ("Got a voicecall event, status: %d, id: %u, number: %s" -" called_number: %s" , call->status, call->id, - call->phone_number.number, call->called_number.number); +" called_number: %s, name: %s" , call->status, call->id, + call->phone_number.number, call->called_number.number, call->name); l =g_slist_find_custom (vc->call_list,GUINT_TO_POINTER (call->id), call_compare_by_id);
Signature · 1 line
1.7.1
Hi Antoine,
Quoted 21 lines · Antoine Reversat
--- drivers/isimodem/voicecall.c | 39 ++++++++++++++++++++++++++++++++++++++- src/voicecall.c | 4 ++-- 2 files changed, 40 insertions(+), 3 deletions(-)drivers/isimodem/voicecall.c +2
-0@@ -56,8 +56,10 @@ struct isi_call {uint8_t cause;uint8_t addr_type;uint8_t presentation; +uint8_t name_presentation;uint8_t reason;char address[20 ]; +char name[20 ];char addr_pad[4 ]; };
drivers/isimodem/voicecall.c static void isi_call_origin_address_sb_proc(struct isi_voicecall *ivc, · line 236
Quoted 4 lines
drivers/isimodem/voicecall.c +1
-0@@ -231,6 +233,7 @@ static void isi_call_origin_address_sb_proc(struct isi_voicecall *ivc,isi_call_any_address_sb_proc (ivc, call, sb); } +
Unrelated change here. Please remove.
Quoted 6 lines
drivers/isimodem/voicecall.c +0
-0static void isi_call_destination_address_sb_proc (struct isi_voicecall *ivc,struct isi_call *call,GIsiSubBlockIter *sb)@@ -239,6 +242,29 @@ static void isi_call_destination_address_sb_proc(struct isi_voicecall *ivc,isi_call_any_address_sb_proc (ivc, call, sb); }
drivers/isimodem/voicecall.c static void isi_call_destination_address_sb_proc(struct isi_voicecall *ivc, · line 253
Quoted 10 lines
drivers/isimodem/voicecall.c +9
-0+static void isi_call_origin_info_sb_proc (struct isi_voicecall *ivc, +struct isi_call *call, +GIsiSubBlockIter *sb) +{ +uint8_t pres; +uint8_t id; +uint8_t len; +char *name; +
Spaces here.
drivers/isimodem/voicecall.c static void isi_call_destination_address_sb_proc(struct isi_voicecall *ivc, · line 258
Quoted 5 lines
drivers/isimodem/voicecall.c +5
-0+if (!g_isi_sb_iter_get_byte (sb, &pres,2 ) || + !g_isi_sb_iter_get_byte (sb, &id,6 ) || + !g_isi_sb_iter_get_byte (sb, &len,7 ) || + !g_isi_sb_iter_get_alpha_tag (sb, &name,2 * len,8 )) +return ;
Isn't this better:
if (!g_isi_sb_iter_get_byte()) return; if (!g_isi_sb_iter_get_byte()) return; if (!g_isi_sb_iter_get_byte()) return; if (!g_isi_sb_iter_get_alpha_tag()) return;
drivers/isimodem/voicecall.c static void isi_call_destination_address_sb_proc(struct isi_voicecall *ivc, · line 259
Quoted 1 line
drivers/isimodem/voicecall.c +1
-0+
spaces here.
drivers/isimodem/voicecall.c static void isi_call_destination_address_sb_proc(struct isi_voicecall *ivc, · line 261
Quoted 2 lines
drivers/isimodem/voicecall.c +2
-0+ +DBG ("Got name %s" , name);
and here.
Quoted 10 lines
drivers/isimodem/voicecall.c +6
-0+ call->name_presentation = pres; +strncpy (call->name, name,sizeof (call->name)); + +g_free (name); +} +static void isi_call_mode_sb_proc (struct isi_voicecall *ivc,struct isi_call *call,GIsiSubBlockIter *sb)
drivers/isimodem/voicecall.c static struct ofono_call isi_call_as_ofono_call(const struct isi_call *call) · line 426
Quoted 5 lines
drivers/isimodem/voicecall.c +2
-0@@ -396,13 +422,19 @@ static struct ofono_call isi_call_as_ofono_call(const struct isi_call *call) ocall.status =isi_call_status_to_clcc (call);memcpy (number->number, call->address,sizeof (number->number)); +memcpy (ocall.name, call->name,sizeof (ocall.name)); +
Extra blank line here.
drivers/isimodem/voicecall.c static struct ofono_call isi_call_as_ofono_call(const struct isi_call *call) · line 430
Quoted 4 lines
drivers/isimodem/voicecall.c +1
-0number->type =0x80 | call->addr_type; ocall.clip_validity = call->presentation &3 ; + ocall.cnap_validity = call->name_presentation &3 ;
spaces here.
Quoted 11 lines
drivers/isimodem/voicecall.c +3
-0if (ocall.clip_validity ==0 &&strlen (number->number) ==0 ) ocall.clip_validity =2 ; +if (ocall.cnap_validity ==0 &&strlen (call->name) ==0 ) + ocall.cnap_validity =2 ; +return ocall; }
drivers/isimodem/voicecall.c static void isi_call_notify(struct ofono_voicecall *ovc, struct isi_call *call) · line 553
Quoted 10 lines
drivers/isimodem/voicecall.c +2
-1@@ -513,11 +545,12 @@ static void isi_call_notify(struct ofono_voicecall *ovc, struct isi_call *call) ocall =isi_call_as_ofono_call (call); - DBG("id=%u,%s,%u,\"%s\",%u,%u", + DBG("id=%u,%s,%u,\"%s\",\"%s\",%u,%u", ocall.id, ocall.direction ? "terminated" : "originated", ocall.status, ocall.phone_number.number, + ocall.name,
Spaces here.
drivers/isimodem/voicecall.c static void isi_call_status_ind_cb(const GIsiMessage *msg, void *data) · line 658
Quoted 8 lines
drivers/isimodem/voicecall.c +1
-0ocall.phone_number.type, ocall.clip_validity);@@ -622,6 +655,10 @@ static void isi_call_status_ind_cb(const GIsiMessage *msg, void *data)isi_call_origin_address_sb_proc (ivc, call, &iter);break ; +case CALL_ORIGIN_INFO :
Extra spaces here.
Quoted 11 lines
drivers/isimodem/voicecall.c +3
-0+isi_call_origin_info_sb_proc (ivc, call, &iter); +break ; +case CALL_GSM_DETAILED_CAUSE :case CALL_DESTINATION_PRE_ADDRESS :case CALL_DESTINATION_POST_ADDRESS :src/voicecall.c +0
-0
src/voicecall.c void ofono_voicecall_notify(struct ofono_voicecall *vc, · line 1955
Quoted 7 lines
src/voicecall.c +2
-2@@ -1951,8 +1951,8 @@ void ofono_voicecall_notify(struct ofono_voicecall *vc,struct ofono_call *newcall;DBG ("Got a voicecall event, status: %d, id: %u, number: %s" -" called_number: %s" , call->status, call->id, - call->phone_number.number, call->called_number.number); +" called_number: %s, name: %s" , call->status, call->id, + call->phone_number.number, call->called_number.number, call->name);
Code over 80 characters.
Signature · 2 lines
Gustavo F. Padovan http://profusion.mobi
Quoted 1 line · Gustavo F. Padovan
Hi Antoine,
Hi
Quoted 9 lines
Quoted 5 lines
+ if (!g_isi_sb_iter_get_byte(sb, &pres, 2) ||
+ !g_isi_sb_iter_get_byte(sb, &id, 6) ||
+ !g_isi_sb_iter_get_byte(sb, &len, 7) ||
+ !g_isi_sb_iter_get_alpha_tag(sb, &name, 2 * len, 8))
+ return;Isn't this better:
Quoted 8 lines
if (!g_isi_sb_iter_get_byte())
return;
if (!g_isi_sb_iter_get_byte())
return;
if (!g_isi_sb_iter_get_byte())
return;
if (!g_isi_sb_iter_get_alpha_tag())
return;
It is better, my code is based on isi_call_any_address_sb_proc which has the same construct. I guess I'll fix both then.
Quoted 1 line
I'll fix the rest and resend the patch, thanks.
PATCH 1/1 Add CNAP support for isimodem
--- drivers/isimodem/voicecall.c | 50 +++++++++++++++++++++++++++++++++++++---- src/voicecall.c | 5 ++- 2 files changed, 48 insertions(+), 7 deletions(-)
drivers/isimodem/voicecall.c +45 -5
@@ -56,8 +56,10 @@ struct isi_call {uint8_t cause;uint8_t addr_type;uint8_t presentation; +uint8_t name_presentation;uint8_t reason;char address[20 ]; +char name[20 ];char addr_pad[4 ]; };
@@ -210,10 +212,13 @@ static void isi_call_any_address_sb_proc(struct isi_voicecall *ivc,uint8_t len;char *addr; -if (!g_isi_sb_iter_get_byte (sb, &type,2 ) || - !g_isi_sb_iter_get_byte (sb, &pres,3 ) || - !g_isi_sb_iter_get_byte (sb, &len,5 ) || - !g_isi_sb_iter_get_alpha_tag (sb, &addr,2 * len,6 )) +if (!g_isi_sb_iter_get_byte (sb, &type,2 )) +return ; +if (!g_isi_sb_iter_get_byte (sb, &pres,3 )) +return ; +if (!g_isi_sb_iter_get_byte (sb, &len,5 )) +return ; +if (!g_isi_sb_iter_get_alpha_tag (sb, &addr,2 * len,6 ))return ; call->addr_type = type |0x80 ;
@@ -239,6 +244,31 @@ static void isi_call_destination_address_sb_proc(struct isi_voicecall *ivc,isi_call_any_address_sb_proc (ivc, call, sb); } +static void isi_call_origin_info_sb_proc (struct isi_voicecall *ivc, +struct isi_call *call, +GIsiSubBlockIter *sb) +{ +uint8_t pres; +uint8_t id; +uint8_t len; +char *name; + +if (!g_isi_sb_iter_get_byte (sb, &pres,2 )) +return ; +if (!g_isi_sb_iter_get_byte (sb, &id,6 )) +return ; +if (!g_isi_sb_iter_get_byte (sb, &len,7 )) +return ; +if (!g_isi_sb_iter_get_alpha_tag (sb, &name,2 * len,8 )) +return ; + +DBG ("Got name %s" , name); + call->name_presentation = pres; +strncpy (call->name, name,sizeof (call->name)); + +g_free (name); +} +static void isi_call_mode_sb_proc (struct isi_voicecall *ivc,struct isi_call *call,GIsiSubBlockIter *sb)
@@ -396,13 +426,18 @@ static struct ofono_call isi_call_as_ofono_call(const struct isi_call *call) ocall.status =isi_call_status_to_clcc (call);memcpy (number->number, call->address,sizeof (number->number)); +memcpy (ocall.name, call->name,sizeof (ocall.name)); number->type =0x80 | call->addr_type; ocall.clip_validity = call->presentation &3 ; + ocall.cnap_validity = call->name_presentation &3 ;if (ocall.clip_validity ==0 &&strlen (number->number) ==0 ) ocall.clip_validity =2 ; +if (ocall.cnap_validity ==0 &&strlen (call->name) ==0 ) + ocall.cnap_validity =2 ; +return ocall; }
@@ -513,11 +548,12 @@ static void isi_call_notify(struct ofono_voicecall *ovc, struct isi_call *call) ocall =isi_call_as_ofono_call (call); -DBG ("id=%u,%s,%u,\"%s\",%u,%u" , +DBG ("id=%u,%s,%u,\"%s\",\"%s\",%u,%u" , ocall.id, ocall.direction ?"terminated" :"originated" , ocall.status, ocall.phone_number.number, + ocall.name, ocall.phone_number.type, ocall.clip_validity);
@@ -622,6 +658,10 @@ static void isi_call_status_ind_cb(const GIsiMessage *msg, void *data)isi_call_origin_address_sb_proc (ivc, call, &iter);break ; +case CALL_ORIGIN_INFO : +isi_call_origin_info_sb_proc (ivc, call, &iter); +break ; +case CALL_GSM_DETAILED_CAUSE :case CALL_DESTINATION_PRE_ADDRESS :case CALL_DESTINATION_POST_ADDRESS :
src/voicecall.c +3 -2
@@ -1951,8 +1951,9 @@ void ofono_voicecall_notify(struct ofono_voicecall *vc,struct ofono_call *newcall;DBG ("Got a voicecall event, status: %d, id: %u, number: %s" -" called_number: %s" , call->status, call->id, - call->phone_number.number, call->called_number.number); +" called_number: %s, called_name %s" , call->status, + call->id, call->phone_number.number, + call->called_number.number, call->name); l =g_slist_find_custom (vc->call_list,GUINT_TO_POINTER (call->id), call_compare_by_id);
Signature · 1 line
1.7.1
Re: [PATCH] Add CNAP support for isimodem
This one should be clean. Sorry it created a new email. I specified a message-id but it don't see it as a reply to my mail in gmail here.
Quoted 134 lines · Antoine Reversat
---
drivers/isimodem/voicecall.c | 50 +++++++++++++++++++++++++++++++++++++----src/voicecall.c| 5 ++-2 files changed, 48 insertions(+), 7 deletions(-)drivers/isimodem/voicecall.c +45
-5@@ -56,8 +56,10 @@ struct isi_call { uint8_t cause; uint8_t addr_type; uint8_t presentation; + uint8_t name_presentation; uint8_t reason; char address[20]; + char name[20]; char addr_pad[4]; };@@ -210,10 +212,13 @@ static void isi_call_any_address_sb_proc(struct isi_voicecall *ivc, uint8_t len; char *addr; - if (!g_isi_sb_iter_get_byte(sb, &type, 2) || - !g_isi_sb_iter_get_byte(sb, &pres, 3) || - !g_isi_sb_iter_get_byte(sb, &len, 5) || - !g_isi_sb_iter_get_alpha_tag(sb, &addr, 2 * len, 6)) + if (!g_isi_sb_iter_get_byte(sb, &type, 2)) + return; + if (!g_isi_sb_iter_get_byte(sb, &pres, 3)) + return; + if (!g_isi_sb_iter_get_byte(sb, &len, 5)) + return; + if (!g_isi_sb_iter_get_alpha_tag(sb, &addr, 2 * len, 6)) return; call->addr_type = type | 0x80;@@ -239,6 +244,31 @@ static void isi_call_destination_address_sb_proc(struct isi_voicecall *ivc, isi_call_any_address_sb_proc(ivc, call, sb); } +static void isi_call_origin_info_sb_proc (struct isi_voicecall *ivc, + struct isi_call *call, + GIsiSubBlockIter *sb) +{ + uint8_t pres; + uint8_t id; + uint8_t len; + char *name; + + if (!g_isi_sb_iter_get_byte(sb, &pres, 2)) + return; + if (!g_isi_sb_iter_get_byte(sb, &id, 6)) + return; + if (!g_isi_sb_iter_get_byte(sb, &len, 7)) + return; + if (!g_isi_sb_iter_get_alpha_tag(sb, &name, 2 * len, 8)) + return; + + DBG("Got name %s", name); + call->name_presentation = pres; + strncpy(call->name, name, sizeof(call->name)); + + g_free(name); +} + static void isi_call_mode_sb_proc(struct isi_voicecall *ivc, struct isi_call *call, GIsiSubBlockIter *sb)@@ -396,13 +426,18 @@ static struct ofono_call isi_call_as_ofono_call(const struct isi_call *call) ocall.status = isi_call_status_to_clcc(call); memcpy(number->number, call->address, sizeof(number->number)); + memcpy(ocall.name, call->name, sizeof(ocall.name)); number->type = 0x80 | call->addr_type; ocall.clip_validity = call->presentation & 3; + ocall.cnap_validity = call->name_presentation & 3; if (ocall.clip_validity == 0 && strlen(number->number) == 0) ocall.clip_validity = 2; + if (ocall.cnap_validity == 0 && strlen(call->name) == 0) + ocall.cnap_validity = 2; + return ocall; }@@ -513,11 +548,12 @@ static void isi_call_notify(struct ofono_voicecall *ovc, struct isi_call *call) ocall = isi_call_as_ofono_call(call); - DBG("id=%u,%s,%u,\"%s\",%u,%u", + DBG("id=%u,%s,%u,\"%s\",\"%s\",%u,%u", ocall.id, ocall.direction ? "terminated" : "originated", ocall.status, ocall.phone_number.number, + ocall.name, ocall.phone_number.type, ocall.clip_validity);@@ -622,6 +658,10 @@ static void isi_call_status_ind_cb(const GIsiMessage *msg, void *data) isi_call_origin_address_sb_proc(ivc, call, &iter); break; + case CALL_ORIGIN_INFO: + isi_call_origin_info_sb_proc(ivc, call, &iter); + break; +case
CALL_GSM_DETAILED_CAUSE:
caseCALL_DESTINATION_PRE_ADDRESS:
caseCALL_DESTINATION_POST_ADDRESS:src/voicecall.c +0
-0@@ -1951,8 +1951,9 @@ void ofono_voicecall_notify(struct ofono_voicecall *vc, struct ofono_call *newcall;DBG("Got a voicecall event, status: %d, id: %u, number: %s"
- "called_number: %s",call->status,call->id,
-call->phone_number.number,call->called_number.number);
+ "called_number: %s,called_name%s",call->status,
+call->id,call->phone_number.number,
+call->called_number.number,call->name);l =
g_slist_find_custom(vc->call_list, GUINT_TO_POINTER(call->id), call_compare_by_id);
--
1.7.1
Re: [PATCH] Add CNAP support for isimodem
Should I have made a second patch for the code cleanup to isi_call_any_address_sb_proc ?
Quoted 139 lines · Antoine Reversat
This one should be clean. Sorry it created a new email. I specified a message-id but it don't see it as a reply to my mail in gmail here.
Quoted 134 lines · Antoine Reversat
---
drivers/isimodem/voicecall.c | 50 +++++++++++++++++++++++++++++++++++++----src/voicecall.c| 5 ++-2 files changed, 48 insertions(+), 7 deletions(-)drivers/isimodem/voicecall.c +45
-5@@ -56,8 +56,10 @@ struct isi_call { uint8_t cause; uint8_t addr_type; uint8_t presentation; + uint8_t name_presentation; uint8_t reason; char address[20]; + char name[20]; char addr_pad[4]; };@@ -210,10 +212,13 @@ static void isi_call_any_address_sb_proc(struct isi_voicecall *ivc, uint8_t len; char *addr; - if (!g_isi_sb_iter_get_byte(sb, &type, 2) || - !g_isi_sb_iter_get_byte(sb, &pres, 3) || - !g_isi_sb_iter_get_byte(sb, &len, 5) || - !g_isi_sb_iter_get_alpha_tag(sb, &addr, 2 * len, 6)) + if (!g_isi_sb_iter_get_byte(sb, &type, 2)) + return; + if (!g_isi_sb_iter_get_byte(sb, &pres, 3)) + return; + if (!g_isi_sb_iter_get_byte(sb, &len, 5)) + return; + if (!g_isi_sb_iter_get_alpha_tag(sb, &addr, 2 * len, 6)) return; call->addr_type = type | 0x80;@@ -239,6 +244,31 @@ static void isi_call_destination_address_sb_proc(struct isi_voicecall *ivc, isi_call_any_address_sb_proc(ivc, call, sb); } +static void isi_call_origin_info_sb_proc (struct isi_voicecall *ivc, + struct isi_call *call, + GIsiSubBlockIter *sb) +{ + uint8_t pres; + uint8_t id; + uint8_t len; + char *name; + + if (!g_isi_sb_iter_get_byte(sb, &pres, 2)) + return; + if (!g_isi_sb_iter_get_byte(sb, &id, 6)) + return; + if (!g_isi_sb_iter_get_byte(sb, &len, 7)) + return; + if (!g_isi_sb_iter_get_alpha_tag(sb, &name, 2 * len, 8)) + return; + + DBG("Got name %s", name); + call->name_presentation = pres; + strncpy(call->name, name, sizeof(call->name)); + + g_free(name); +} + static void isi_call_mode_sb_proc(struct isi_voicecall *ivc, struct isi_call *call, GIsiSubBlockIter *sb)@@ -396,13 +426,18 @@ static struct ofono_call isi_call_as_ofono_call(const struct isi_call *call) ocall.status = isi_call_status_to_clcc(call); memcpy(number->number, call->address, sizeof(number->number)); + memcpy(ocall.name, call->name, sizeof(ocall.name)); number->type = 0x80 | call->addr_type; ocall.clip_validity = call->presentation & 3; + ocall.cnap_validity = call->name_presentation & 3; if (ocall.clip_validity == 0 && strlen(number->number) == 0) ocall.clip_validity = 2; + if (ocall.cnap_validity == 0 && strlen(call->name) == 0) + ocall.cnap_validity = 2; + return ocall; }@@ -513,11 +548,12 @@ static void isi_call_notify(struct ofono_voicecall *ovc, struct isi_call *call) ocall = isi_call_as_ofono_call(call); - DBG("id=%u,%s,%u,\"%s\",%u,%u", + DBG("id=%u,%s,%u,\"%s\",\"%s\",%u,%u", ocall.id, ocall.direction ? "terminated" : "originated", ocall.status, ocall.phone_number.number, + ocall.name, ocall.phone_number.type, ocall.clip_validity);@@ -622,6 +658,10 @@ static void isi_call_status_ind_cb(const GIsiMessage *msg, void *data) isi_call_origin_address_sb_proc(ivc, call, &iter); break; + case CALL_ORIGIN_INFO: + isi_call_origin_info_sb_proc(ivc, call, &iter); + break; +case
CALL_GSM_DETAILED_CAUSE:
caseCALL_DESTINATION_PRE_ADDRESS:
caseCALL_DESTINATION_POST_ADDRESS:src/voicecall.c +0
-0@@ -1951,8 +1951,9 @@ void ofono_voicecall_notify(struct ofono_voicecall *vc, struct ofono_call *newcall;DBG("Got a voicecall event, status: %d, id: %u, number: %s"
- "called_number: %s",call->status,call->id,
-call->phone_number.number,call->called_number.number);
+ "called_number: %s,called_name%s",call->status,
+call->id,call->phone_number.number,
+call->called_number.number,call->name);l =
g_slist_find_custom(vc->call_list, GUINT_TO_POINTER(call->id), call_compare_by_id);
--
1.7.1
Re: [PATCH] Add CNAP support for isimodem
In reply to Antoine ReversatHy Antoine,
Top posting is not allowed on this mailing list. Please stop using it.
Quoted 2 lines · Antoine Reversat
This one should be clean. Sorry it created a new email. I specified a message-id but it don't see it as a reply to my mail in gmail here.
Get yourself a proper mail client. Your message shows a reply of the previous patch.
Quoted 26 lines · Antoine Reversat
Quoted 24 lines
---
drivers/isimodem/voicecall.c | 50 +++++++++++++++++++++++++++++++++++++----src/voicecall.c| 5 ++-2 files changed, 48 insertions(+), 7 deletions(-)drivers/isimodem/voicecall.c +2
-0@@ -56,8 +56,10 @@ struct isi_call { uint8_t cause; uint8_t addr_type; uint8_t presentation; + uint8_t name_presentation; uint8_t reason; char address[20]; + char name[20]; char addr_pad[4]; };@@ -210,10 +212,13 @@ static void isi_call_any_address_sb_proc(struct isi_voicecall *ivc, uint8_t len; char *addr;
Quoted 11 lines
drivers/isimodem/voicecall.c static void isi_call_any_address_sb_proc(struct isi_voicecall *ivc, · line 221
Quoted 11 lines
drivers/isimodem/voicecall.c +7
-4- if (!g_isi_sb_iter_get_byte(sb, &type, 2) || - !g_isi_sb_iter_get_byte(sb, &pres, 3) || - !g_isi_sb_iter_get_byte(sb, &len, 5) || - !g_isi_sb_iter_get_alpha_tag(sb, &addr, 2 * len, 6)) + if (!g_isi_sb_iter_get_byte(sb, &type, 2)) + return; + if (!g_isi_sb_iter_get_byte(sb, &pres, 3)) + return; + if (!g_isi_sb_iter_get_byte(sb, &len, 5)) + return; + if (!g_isi_sb_iter_get_alpha_tag(sb, &addr, 2 * len, 6))
A separate patch for this change.
Signature · 2 lines
Gustavo F. Padovan http://profusion.mobi
Re: [PATCH] Add CNAP support for isimodem
Quoted 3 lines · Gustavo F. Padovan
Hy Antoine,
Top posting is not allowed on this mailing list. Please stop using it.
Sorry about that.
Quoted 3 lines
A separate patch for this change.
Will do.
Quoted 8 lines
--
Gustavo F. Padovan
http://profusion.mobi
_______________________________________________
ofono mailing list
ofono(a)ofono.org
http://lists.ofono.org/listinfo/ofono
PATCH 1/2 Clean up isi_call_any_address_sb_proc
--- drivers/isimodem/voicecall.c | 11 +++++++---- 1 files changed, 7 insertions(+), 4 deletions(-)
drivers/isimodem/voicecall.c +7 -4
@@ -210,10 +210,13 @@ static void isi_call_any_address_sb_proc(struct isi_voicecall *ivc,uint8_t len;char *addr; -if (!g_isi_sb_iter_get_byte (sb, &type,2 ) || - !g_isi_sb_iter_get_byte (sb, &pres,3 ) || - !g_isi_sb_iter_get_byte (sb, &len,5 ) || - !g_isi_sb_iter_get_alpha_tag (sb, &addr,2 * len,6 )) +if (!g_isi_sb_iter_get_byte (sb, &type,2 )) +return ; +if (!g_isi_sb_iter_get_byte (sb, &pres,3 )) +return ; +if (!g_isi_sb_iter_get_byte (sb, &len,5 )) +return ; +if (!g_isi_sb_iter_get_alpha_tag (sb, &addr,2 * len,6 ))return ; call->addr_type = type |0x80 ;
Signature · 1 line
1.7.1
PATCH 2/2 Add CNAP support for isimodem
In reply to Antoine Reversat--- drivers/isimodem/voicecall.c | 39 ++++++++++++++++++++++++++++++++++++++- src/voicecall.c | 5 +++-- 2 files changed, 41 insertions(+), 3 deletions(-)
drivers/isimodem/voicecall.c +38 -1
@@ -56,8 +56,10 @@ struct isi_call {uint8_t cause;uint8_t addr_type;uint8_t presentation; +uint8_t name_presentation;uint8_t reason;char address[20 ]; +char name[20 ];char addr_pad[4 ]; };
@@ -242,6 +244,31 @@ static void isi_call_destination_address_sb_proc(struct isi_voicecall *ivc,isi_call_any_address_sb_proc (ivc, call, sb); } +static void isi_call_origin_info_sb_proc (struct isi_voicecall *ivc, +struct isi_call *call, +GIsiSubBlockIter *sb) +{ +uint8_t pres; +uint8_t id; +uint8_t len; +char *name; + +if (!g_isi_sb_iter_get_byte (sb, &pres,2 )) +return ; +if (!g_isi_sb_iter_get_byte (sb, &id,6 )) +return ; +if (!g_isi_sb_iter_get_byte (sb, &len,7 )) +return ; +if (!g_isi_sb_iter_get_alpha_tag (sb, &name,2 * len,8 )) +return ; + +DBG ("Got name %s" , name); + call->name_presentation = pres; +strncpy (call->name, name,sizeof (call->name)); + +g_free (name); +} +static void isi_call_mode_sb_proc (struct isi_voicecall *ivc,struct isi_call *call,GIsiSubBlockIter *sb)
@@ -399,13 +426,18 @@ static struct ofono_call isi_call_as_ofono_call(const struct isi_call *call) ocall.status =isi_call_status_to_clcc (call);memcpy (number->number, call->address,sizeof (number->number)); +memcpy (ocall.name, call->name,sizeof (ocall.name)); number->type =0x80 | call->addr_type; ocall.clip_validity = call->presentation &3 ; + ocall.cnap_validity = call->name_presentation &3 ;if (ocall.clip_validity ==0 &&strlen (number->number) ==0 ) ocall.clip_validity =2 ; +if (ocall.cnap_validity ==0 &&strlen (call->name) ==0 ) + ocall.cnap_validity =2 ; +return ocall; }
@@ -516,11 +548,12 @@ static void isi_call_notify(struct ofono_voicecall *ovc, struct isi_call *call) ocall =isi_call_as_ofono_call (call); -DBG ("id=%u,%s,%u,\"%s\",%u,%u" , +DBG ("id=%u,%s,%u,\"%s\",\"%s\",%u,%u" , ocall.id, ocall.direction ?"terminated" :"originated" , ocall.status, ocall.phone_number.number, + ocall.name, ocall.phone_number.type, ocall.clip_validity);
@@ -625,6 +658,10 @@ static void isi_call_status_ind_cb(const GIsiMessage *msg, void *data)isi_call_origin_address_sb_proc (ivc, call, &iter);break ; +case CALL_ORIGIN_INFO : +isi_call_origin_info_sb_proc (ivc, call, &iter); +break ; +case CALL_GSM_DETAILED_CAUSE :case CALL_DESTINATION_PRE_ADDRESS :case CALL_DESTINATION_POST_ADDRESS :
src/voicecall.c +3 -2
@@ -1951,8 +1951,9 @@ void ofono_voicecall_notify(struct ofono_voicecall *vc,struct ofono_call *newcall;DBG ("Got a voicecall event, status: %d, id: %u, number: %s" -" called_number: %s" , call->status, call->id, - call->phone_number.number, call->called_number.number); +" called_number: %s, called_name %s" , call->status, + call->id, call->phone_number.number, + call->called_number.number, call->name); l =g_slist_find_custom (vc->call_list,GUINT_TO_POINTER (call->id), call_compare_by_id);
Signature · 1 line
1.7.1
Re: [PATCH 1/2] Clean up isi_call_any_address_sb_proc
In reply to Antoine ReversatHi Antoine,
Quoted 14 lines · Antoine Reversat
--- drivers/isimodem/voicecall.c | 11 +++++++---- 1 files changed, 7 insertions(+), 4 deletions(-)drivers/isimodem/voicecall.c +0
-2@@ -210,10 +210,13 @@ static void isi_call_any_address_sb_proc(struct isi_voicecall *ivc,uint8_t len;char *addr; - if (!g_isi_sb_iter_get_byte(sb, &type, 2) || - !g_isi_sb_iter_get_byte(sb, &pres, 3) ||
drivers/isimodem/voicecall.c static void isi_call_any_address_sb_proc(struct isi_voicecall *ivc, · line 220
Quoted 10 lines
drivers/isimodem/voicecall.c +7
-2- !g_isi_sb_iter_get_byte (sb, &len,5 ) || - !g_isi_sb_iter_get_alpha_tag(sb, &addr, 2 * len, 6)) +if (!g_isi_sb_iter_get_byte (sb, &type,2 )) +return ; +if (!g_isi_sb_iter_get_byte (sb, &pres,3 )) +return ; +if (!g_isi_sb_iter_get_byte (sb, &len,5 )) +return ; +if (!g_isi_sb_iter_get_alpha_tag (sb, &addr,2 * len,6 ))return ;
This is indeed the preferred structure, however please note doc/coding-style.txt rule M1.
drivers/isimodem/voicecall.c static void isi_call_any_address_sb_proc(struct isi_voicecall *ivc, · line 222
Quoted 2 lines
drivers/isimodem/voicecall.c +0
-0call->addr_type = type |0x80 ;
Regards,
-Denis
Re: [PATCH 2/2] Add CNAP support for isimodem
In reply to Antoine ReversatHi Antoine,
Quoted 32 lines · Antoine Reversat
--- drivers/isimodem/voicecall.c | 39 ++++++++++++++++++++++++++++++++++++++- src/voicecall.c | 5 +++-- 2 files changed, 41 insertions(+), 3 deletions(-)drivers/isimodem/voicecall.c +10
-0@@ -56,8 +56,10 @@ struct isi_call {uint8_t cause;uint8_t addr_type;uint8_t presentation; +uint8_t name_presentation;uint8_t reason;char address[20 ]; +char name[20 ];char addr_pad[4 ]; };@@ -242,6 +244,31 @@ static void isi_call_destination_address_sb_proc(struct isi_voicecall *ivc,isi_call_any_address_sb_proc (ivc, call, sb); } +static void isi_call_origin_info_sb_proc (struct isi_voicecall *ivc, +struct isi_call *call, +GIsiSubBlockIter *sb) +{ +uint8_t pres; +uint8_t id; +uint8_t len; +char *name;
drivers/isimodem/voicecall.c static void isi_call_destination_address_sb_proc(struct isi_voicecall *ivc, · line 264
Quoted 10 lines
drivers/isimodem/voicecall.c +10
-0+ +if (!g_isi_sb_iter_get_byte (sb, &pres,2 )) +return ; +if (!g_isi_sb_iter_get_byte (sb, &id,6 )) +return ; +if (!g_isi_sb_iter_get_byte (sb, &len,7 )) +return ; +if (!g_isi_sb_iter_get_alpha_tag (sb, &name,2 * len,8 )) +return ; +
Rule M1 please.
Quoted 11 lines
drivers/isimodem/voicecall.c +7
-0+DBG ("Got name %s" , name); + call->name_presentation = pres; +strncpy (call->name, name,sizeof (call->name)); + +g_free (name); +} +static void isi_call_mode_sb_proc (struct isi_voicecall *ivc,struct isi_call *call,GIsiSubBlockIter *sb)
drivers/isimodem/voicecall.c static struct ofono_call isi_call_as_ofono_call(const struct isi_call *call) · line 433
Quoted 8 lines
drivers/isimodem/voicecall.c +2
-0@@ -399,13 +426,18 @@ static struct ofono_call isi_call_as_ofono_call(const struct isi_call *call) ocall.status =isi_call_status_to_clcc (call);memcpy (number->number, call->address,sizeof (number->number)); +memcpy (ocall.name, call->name,sizeof (ocall.name)); number->type =0x80 | call->addr_type; ocall.clip_validity = call->presentation &3 ; + ocall.cnap_validity = call->name_presentation &3 ;
This looks like it has spaces instead of tabs for indentation.
Quoted 25 lines
drivers/isimodem/voicecall.c +5
-1if (ocall.clip_validity ==0 &&strlen (number->number) ==0 ) ocall.clip_validity =2 ; +if (ocall.cnap_validity ==0 &&strlen (call->name) ==0 ) + ocall.cnap_validity =2 ; +return ocall; }@@ -516,11 +548,12 @@ static void isi_call_notify(struct ofono_voicecall *ovc, struct isi_call *call) ocall =isi_call_as_ofono_call (call); -DBG ("id=%u,%s,%u,\"%s\",%u,%u" , +DBG ("id=%u,%s,%u,\"%s\",\"%s\",%u,%u" , ocall.id, ocall.direction ?"terminated" :"originated" , ocall.status, ocall.phone_number.number, + ocall.name, ocall.phone_number.type, ocall.clip_validity);
drivers/isimodem/voicecall.c static void isi_call_status_ind_cb(const GIsiMessage *msg, void *data) · line 667
Quoted 10 lines
drivers/isimodem/voicecall.c +4
-0@@ -625,6 +658,10 @@ static void isi_call_status_ind_cb(const GIsiMessage *msg, void *data)isi_call_origin_address_sb_proc (ivc, call, &iter);break ; +case CALL_ORIGIN_INFO : +isi_call_origin_info_sb_proc (ivc, call, &iter); +break ; +case CALL_GSM_DETAILED_CAUSE :case CALL_DESTINATION_PRE_ADDRESS :case CALL_DESTINATION_POST_ADDRESS :
I'm assuming you have tested this and it is correctly reporting CNAP indications?
Quoted 6 lines
src/voicecall.c +0
-0@@ -1951,8 +1951,9 @@ void ofono_voicecall_notify(struct ofono_voicecall *vc,struct ofono_call *newcall;
src/voicecall.c void ofono_voicecall_notify(struct ofono_voicecall *vc, · line 1959
Quoted 10 lines
src/voicecall.c +3
-2DBG ("Got a voicecall event, status: %d, id: %u, number: %s" -" called_number: %s" , call->status, call->id, - call->phone_number.number, call->called_number.number); +" called_number: %s, called_name %s" , call->status, + call->id, call->phone_number.number, + call->called_number.number, call->name); l =g_slist_find_custom (vc->call_list,GUINT_TO_POINTER (call->id), call_compare_by_id);
Please send this chunk as a separate patch. In general we prefer to have patches split up by directories. See HACKING document in ofono git, specifically the Submitting Patches section.
Regards,
-Denis