短信猫二次开发

package com.project.lzsxxglpt.sms.messageutil;


import java.io.IOException;
import java.util.List;
import java.util.Map;


import org.apache.log4j.Logger;
import org.smslib.GatewayException;
import org.smslib.Message.MessageEncodings;
import org.smslib.OutboundMessage;
import org.smslib.SMSLibException;
import org.smslib.Service;
import org.smslib.TimeoutException;
import org.smslib.modem.SerialModemGateway;
import org.smslib.AGateway;
public class MessageUtil{
private static String rwlx;
public static void SendMessage(List<Map<String,Object>> list){
//短信服务
Service service = Service.getInstance();
//构建gateway
SerialModemGateway gateway = new SerialModemGateway("model.com4", "COM4", 9600, "wavecom","");
gateway.setInbound(true);//网关写入信息
gateway.setOutbound(true);//网关读取信息
gateway.setSimPin("0000");//sim卡的pin密码
try {
for (Map<String, Object> map : list) {
service.addGateway(gateway);
String rwmc = map.get("rwmc").toString();
int i = Integer.parseInt(map.get("rwlx").toString());
if(i == 1){
rwlx = "test";
}else if(i == 2){
rwlx = "test";
}else if(i == 3){
rwlx = "test";
}
String kssj = map.get("kssj").toString();
String jzsj = map.get("jzsj").toString();
String zrrid = map.get("zrrid").toString();
String name = map.get("username").toString();
String tell = map.get("tell").toString();
String unit = map.get("unitname").toString();
OutboundMessage message = new OutboundMessage(tell,null);
message.setEncoding(MessageEncodings.ENCUCS2); // 中文
message.addText("test");
System.out.print("MESSAGE SERVICE START------");
service.startService();
System.out.println("----DONE");
System.out.print("MESSAGE SEND------");
service.sendMessage(message);
gateway.stopGateway();//释放gateway
service.stopService();//停止服务
service.removeGateway(gateway);
}
System.out.println("--DONE");
System.out.println("SERVICE STOP!");
} catch (Exception e) {
// TODO 自动生成的 catch 块
e.printStackTrace();
}
}
}
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Introduction This document describes configuration options for FTDIBUS.SYS. For most operating environments, the default configuration of FTDIBUS is sufficient for normal operation, and it is very unlikely that any of the parameters described here need to be altered. ResetPipeRequestRetryCount ResetPipeRequestRetryCount controls the maximum number of times that FTDIBUS tries to reset a pipe on which an error has occurred. ResetPipeRequestRetryCount defaults to 50. It may be necessary to increase this value in noisy environments where a lot of USB errors occur. The default can be overridden via RetryResetCount in the FTDIBUS service key HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\FTDIBUS\Parameters\RetryResetCount The device can be installed with ResetPipeRequestRetryCount set to any value by changing FTDIBUS.INF as shown in the following fragment. [FtdiBus_AddService.AddReg] HKR,Parameters,"RetryResetCount",0x10001,100 Here, the count is set to 100. MaxDevices MaxDevices is used to place a limit on the number of COM ports that can be created in a system by FTDIBUS. MaxDevices defaults to 0, meaning that the feature is disabled and FTDIBUS always attempts to create a COM port. The default can be overridden via MaxDevs in the FTDIBUS service key. Note that setting MaxDevs to a value other than zero will radically alter the behaviour of the driver; please contact FTDI if you think you have to change MaxDevs. HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\FTDIBUS\Parameters\MaxDevs The device can be installed with MaxDevs set to any value by changing FTDIBUS.INF as shown in the following fragment. [FtdiBus_AddService.AddReg] HKR,Parameters,"MaxDevs",0x10001,3 Here, the maximum number of devices is set to 3. Location IDs Location IDs is used to define the set of USB ports supported by FTDIBUS. It can be used in systems that require only certain USB ports to be available, perhaps in conjunction with MaxDevices. The default behaviour is that all USB ports are supported. The default can be overridden via LocIds in the FTDIBUS service key. Note that setting LocIds will radically alter the behaviour of the driver; please contact FTDI if you think you have to change LocIds. HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\FTDIBUS\Parameters\LocIds LocIds is a binary value that is interpreted as an array of Location IDs. A Location ID is a 32-bit unsigned integer (DWORD) that represents the location of the device in the USB tree. For example, if the driver creates a location string for the device of the form a&b&c, the location ID will be 0x00000abc. The device can be installed with LocIds set by changing FTDIBUS.INF as shown in the following fragment. [FtdiBus_AddService.AddReg] HKR,Parameters,"LocIds",1,21,00,00,00,32,00,00,00,11,00,00,00 Here, three USB ports are supported. Location ID 0x00000021 represents host controller 1 port 1. Location ID 0x00000032 represents host controller 2 port 2. Location ID 0x00000011 represents host controller 0 port 1. Location IDs can be obtained using the latest version of the utility USBView available from FTDI support. FTDI 19 January 2004
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值