📄 sminterface.java
字号:
// Decompiled by Jad v1.5.7g. Copyright 2000 Pavel Kouznetsov.
// Jad home page: http://www.geocities.com/SiliconValley/Bridge/8617/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi
// Source File Name: SmInterface.java
import aiismg.jcmppapi.CMPPAPI;
public class SmInterface
{
private String path;
CMPPAPI m_cmppApi;
public SmInterface()
{
m_cmppApi = new CMPPAPI();
}
public void connect() throws Exception
{
String javacmppcUrl = path + "javacmppc.ini";
System.out.println("connect sms here");
if (m_cmppApi.InitCMPPAPI(javacmppcUrl) != 0)
{
throw new Exception("CMPP Init failed.");
}
}
/**
* 提供给MAIN函数使用
* @throws Exception
*/
public void main_connect() throws Exception
{
path="E:/Appframe/workspace/SmInterface/";//$$
String javacmppcUrl = path+"javacmppc.ini";
System.out.println("connect sms here");
if (m_cmppApi.InitCMPPAPI(javacmppcUrl) != 0)
{
throw new Exception("CMPP Init failed.");
}
}
public boolean submitMsg(
String sourceAddr,
String destAddr,
String message)
throws Exception
{
boolean bRet =
submitShortMsg(
sourceAddr,
destAddr,
// message.substring(iStart, iStart + len) + strAppend);
message);
if (!bRet)
return false;
// }
return true;
}
public boolean submitShortMsg(
String sourceAddr,
String destAddr,
String msg)
throws Exception
{
System.out.println(m_cmppApi);
// System.out.println(m_cmppApi.CMPPActiveTest());
//byte nNeedReply = 0;
//byte nMsgLevel = 2;
byte sServiceID[] = "10658466".getBytes();
byte nMsgFormat = 15;
byte sFeeType[] = "01".getBytes();
byte sFeeCode[] = "0".getBytes();
byte sValidTime[] = "".getBytes();
byte sAtTime[] = "".getBytes();
byte sSrcTermID[] = new byte[21];
System.arraycopy(
sourceAddr.getBytes(),
0,
sSrcTermID,
0,
sourceAddr.length());
byte sDestTermID[] = new byte[21];
System.arraycopy(
destAddr.getBytes(),
0,
sDestTermID,
0,
destAddr.length());
byte sMsgContent[] = msg.getBytes("GBK");
// byte sMsgContent[] = msg.getBytes("ISO-10646-UCS-2");
int nMsgLen = sMsgContent.length;
// int nMsgLen=BOutContent.length;
byte sMsgID[] = new byte[200];
byte errorcode = 0;
byte cFeeUserType[] = "0".getBytes();
int retCode = 1;
try
{
retCode =
m_cmppApi.CMPPSendLongSingle(
(byte) 0,
(byte) 2,
sServiceID,
nMsgFormat,
sFeeType,
sFeeCode,
sValidTime,
sAtTime,
sSrcTermID,
sDestTermID,
nMsgLen,
sMsgContent,
sMsgID,
errorcode,
cFeeUserType,
(byte) 0,
(byte) 0);
}
catch (Exception e)
{
e.printStackTrace();
}
System.out.println("the source address = " + sourceAddr);
System.out.println("the msg length = " + nMsgLen);
System.out.println("the error code = " + m_cmppApi.GetErrCode());
System.out.println("the return code = " + retCode);
return retCode == 0;
}
public void close() throws Exception
{
}
public static void main(String args[])
{
try
{
SmInterface smInterface = new SmInterface();
smInterface.main_connect();
System.out.println(smInterface.submitMsg("", "13632320554", "成功在低价位的中不少用户在低价位的中不少用用在低价位的中不少用户在低价位的中不少用用在低价位的中不少用户在低价位的中不少用用在低价位的中不少用户在低价位的中不少用用dddd"));
smInterface.close();
}
catch(Exception e)
{
e.printStackTrace();
}
}
/**
* @return
*/
public String getPath()
{
return path;
}
/**
* @param string
*/
public void setPath(String string)
{
path = string;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -