From 315e8b45506745f4b28f658772cc65cdef9a2d9e Mon Sep 17 00:00:00 2001 From: erin_yueh Date: Thu, 3 Jan 2008 09:13:39 +0000 Subject: gsmd: add Call Forwarding function (Sean Chiang) git-svn-id: http://svn.openmoko.org/trunk/src/target/gsm@3760 99fdad57-331a-0410-800a-d7fa5415bdb3 --- src/libgsmd/libgsmd_voicecall.c | 123 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 123 insertions(+) (limited to 'src/libgsmd') diff --git a/src/libgsmd/libgsmd_voicecall.c b/src/libgsmd/libgsmd_voicecall.c index 8804cce..c40ea51 100644 --- a/src/libgsmd/libgsmd_voicecall.c +++ b/src/libgsmd/libgsmd_voicecall.c @@ -125,3 +125,126 @@ int lgsm_voice_ctrl(struct lgsm_handle *lh, const struct lgsm_voicecall_ctrl *ct return 0; } + +int lgsm_voice_fwd_disable(struct lgsm_handle *lh, + enum lgsmd_voicecall_fwd_reason reason) +{ + struct gsmd_msg_hdr *gmh; + int rc; + + gmh = lgsm_gmh_fill(GSMD_MSG_VOICECALL, + GSMD_VOICECALL_FWD_DIS, sizeof(int)); + if (!gmh) + return -ENOMEM; + + *(int *) gmh->data = reason; + + rc = lgsm_send(lh, gmh); + if (rc < gmh->len + sizeof(*gmh)) { + lgsm_gmh_free(gmh);; + return -EIO; + } + + lgsm_gmh_free(gmh); + + return 0; +} + +int lgsm_voice_fwd_enable(struct lgsm_handle *lh, + enum lgsmd_voicecall_fwd_reason reason) +{ + struct gsmd_msg_hdr *gmh; + int rc; + + gmh = lgsm_gmh_fill(GSMD_MSG_VOICECALL, + GSMD_VOICECALL_FWD_EN, sizeof(int)); + if (!gmh) + return -ENOMEM; + + *(int *) gmh->data = reason; + + rc = lgsm_send(lh, gmh); + if (rc < gmh->len + sizeof(*gmh)) { + lgsm_gmh_free(gmh);; + return -EIO; + } + + lgsm_gmh_free(gmh); + + return 0; +} + +int lgsm_voice_fwd_stat(struct lgsm_handle *lh, + enum lgsmd_voicecall_fwd_reason reason) +{ + struct gsmd_msg_hdr *gmh; + int rc; + + gmh = lgsm_gmh_fill(GSMD_MSG_VOICECALL, + GSMD_VOICECALL_FWD_STAT, sizeof(int)); + if (!gmh) + return -ENOMEM; + + *(int *) gmh->data = reason; + + rc = lgsm_send(lh, gmh); + if (rc < gmh->len + sizeof(*gmh)) { + lgsm_gmh_free(gmh);; + return -EIO; + } + + lgsm_gmh_free(gmh); + + return 0; +} + +int lgsm_voice_fwd_reg(struct lgsm_handle *lh, + struct lgsm_voicecall_fwd_reg *fwd_reg) +{ + struct gsmd_msg_hdr *gmh; + struct gsmd_call_fwd_reg *gcfr; + int rc; + + gmh = lgsm_gmh_fill(GSMD_MSG_VOICECALL, + GSMD_VOICECALL_FWD_REG, sizeof(struct gsmd_call_fwd_reg)); + if (!gmh) + return -ENOMEM; + + gcfr = (struct gsmd_call_fwd_reg *)gmh->data; + gcfr->reason = fwd_reg->reason; + strcpy(gcfr->addr.number, fwd_reg->number.addr); + + rc = lgsm_send(lh, gmh); + if (rc < gmh->len + sizeof(*gmh)) { + lgsm_gmh_free(gmh);; + return -EIO; + } + + lgsm_gmh_free(gmh); + + return 0; +} + +int lgsm_voice_fwd_erase(struct lgsm_handle *lh, + enum lgsmd_voicecall_fwd_reason reason) +{ + struct gsmd_msg_hdr *gmh; + int rc; + + gmh = lgsm_gmh_fill(GSMD_MSG_VOICECALL, + GSMD_VOICECALL_FWD_ERAS, sizeof(int)); + if (!gmh) + return -ENOMEM; + + *(int *) gmh->data = reason; + + rc = lgsm_send(lh, gmh); + if (rc < gmh->len + sizeof(*gmh)) { + lgsm_gmh_free(gmh);; + return -EIO; + } + + lgsm_gmh_free(gmh); + + return 0; +} -- cgit v1.2.3