首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何在GSMComm库中拼接长短信?

如何在GSMComm库中拼接长短信?
EN

Stack Overflow用户
提问于 2016-01-21 16:06:54
回答 2查看 1.9K关注 0票数 6

下面是我的代码:

根据这个pageCreateConcatTextMessage方法返回一个类型为SmsSubmitPdu[]的数组,但是,当我尝试用SendMessages发送它时,我得到了一个MessageServiceError 500。我遗漏了什么?

代码语言:javascript
复制
       SmsSubmitPdu[] pdu2;

        try{
            pdu2 = SmartMessageFactory.CreateConcatTextMessage("My name is Barry Allen. And I am the fastest man alive. When I was a child I saw my mother killed by something impossible. My father went to prison for her murder.", "+639234597676");
            comm.SendMessages(pdu2);
        }

        catch (MessageServiceErrorException e500){
            MessageBox.Show(e500.ToString(), "Information", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
        }
        catch (CommException e501){
            MessageBox.Show(e501.ToString(), "Information", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
        }
EN

回答 2

Stack Overflow用户

发布于 2016-11-09 03:06:38

您的代码应该如下所示:

代码语言:javascript
复制
GsmCommMain comm=new GsmCommMain(/*Set your option here*/);

string txtMessage="your long message...";
string txtDestinationNumbers="your destination number";

//select unicode option by a checkBox or any other control
bool unicode = chkUnicode.Checked;

SmsSubmitPdu[] pdu = SmartMessageFactory.CreateConcatTextMessage(txtMessage, unicode, txtDestinationNumbers);
сomm.SendMessages(pdu);
票数 8
EN

Stack Overflow用户

发布于 2016-05-28 18:18:42

输入不带县代码的号码。

代码语言:javascript
复制
using GsmComm.GsmCommunication;
using GsmComm.PduConverter;
using GsmComm.PduConverter.SmartMessaging; 
using System;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            try
            {
                GsmCommMain comm = new GsmCommMain("COM7", 19200, 500);
                comm.Open();
                string txtMessage = "Input here very long message please ";
                string txtDestinationNumbers = "+79235280406";
                bool unicode = true;  
                SmsSubmitPdu[] pdu = SmartMessageFactory.CreateConcatTextMessage(txtMessage, unicode, txtDestinationNumbers);
                comm.SendMessages(pdu);
            }
            catch (Exception ex)
            {
                throw;
            }
        }
    }
}

https://github.com/welly87/GSMComm

票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/34918362

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档