Hi I use some converting tools to change sendmassege sample from c#
to vb but after converting it recognize the modem but i did n't recive
massage please send me help and how I attach the files
codes:
Imports System.Text
Imports System.Collections
Imports System.Threading
Imports org.smslib
Imports org.smslib.modem
Namespace SendMessage
Friend Class SendMessage
Public Class CallNotification
Implements ICallNotification
Public Sub process(ByVal gatewayId As String, ByVal
callerId As
String) Implements ICallNotification.process
End Sub
End Class
Public Class InboundNotification
Implements IInboundMessageNotification
Public Sub process(ByVal gatewayId As String, ByVal
msgType As
org.smslib.Message.MessageTypes, ByVal msg As InboundMessage)
Implements IInboundMessageNotification.process
End Sub
End Class
Public Class GatewayStatusNotification
Implements IGatewayStatusNotification
Public Sub process(ByVal gatewayId As String, ByVal
oldStatus As
org.smslib.AGateway.GatewayStatuses, ByVal newStatus As
org.smslib.AGateway.GatewayStatuses) Implements
IGatewayStatusNotification.process
End Sub
End Class
Shared Sub Main(ByVal args() As String)
Dim srv As Service
Try
Console.WriteLine("Example: Read messages from
a serial gsm
modem.")
Console.WriteLine(Library.getLibraryDescription())
Console.WriteLine("Version: " &
Library.getLibraryVersion())
' *** The tricky part ***
' *** Comm2IP Driver ***
' Create (and start!) as many Comm2IP threads
as the modems you
are using.
' Be careful about the mappings - use the same
mapping in the
Gateway definition.
Dim com4 As New Comm2IP.Comm2IP(New Byte() {
127, 0, 0, 1 },
12000, "com4", 19200)
CType(New Thread(New ThreadStart(AddressOf
com4.Run)),
Thread).Start()
' Create new Service object - the parent of all
and the main
interface to you.
srv = New Service()
' Lets set some callbacks.
srv.setInboundMessageNotification(New
InboundNotification())
srv.setCallNotification(New CallNotification())
srv.setGatewayStatusNotification(New
GatewayStatusNotification())
' Create the Gateway representing the serial
GSM modem.
' Due to the Comm2IP bridge, in SMSLib for .NET
all modems are
considered IP modems.
Dim gateway As New IPModemGateway("modem.com4",
"127.0.0.1",
12000, "Nokia", "")
gateway.setIpProtocol(ModemGateway.IPProtocols.BINARY)
' Set the modem protocol to PDU (alternative is
TEXT). PDU is the
default, anyway...
gateway.setProtocol(AGateway.Protocols.PDU)
' Do we want the Gateway to be used for Inbound
messages?
gateway.setInbound(True)
' Do we want the Gateway to be used for
Outbound messages?
gateway.setOutbound(True)
' Let SMSLib know which is the SIM PIN.
gateway.setSimPin("6317")
' Add the Gateway to the Service object.
srv.addGateway(gateway)
' Similarly, you may define as many Gateway
objects, representing
' various GSM modems, add them in the Service
object and control
all of them.
' Start! (i.e. connect to all defined Gateways)
srv.startService()
' Printout some general information about the
modem.
Console.WriteLine()
Console.WriteLine("Modem Information:")
Console.WriteLine(" Manufacturer: " &
gateway.getManufacturer())
Console.WriteLine(" Model: " &
gateway.getModel())
Console.WriteLine(" Serial No: " &
gateway.getSerialNo())
Console.WriteLine(" SIM IMSI: " &
gateway.getImsi())
Console.WriteLine(" Signal Level: " &
gateway.getSignalLevel() &
"%")
Console.WriteLine(" Battery Level: " &
gateway.getBatteryLevel()
& "%")
Console.WriteLine()
' Send one message.
' Remember to change the recipient!
Dim msg As New OutboundMessage("98758865", "this is
test")
srv.sendMessage(msg)
Console.WriteLine(msg)
' Send more than one message at once.
'OutboundMessage[] msgArray = new
OutboundMessage[2];
'msgArray[0] = new
OutboundMessage("+306948494037", "Hello from
SMSLib for .NET (#1)");
'msgArray[1] = new
OutboundMessage("09384578304", "Hello from
SMSLib for .NET (#2)");
'srv.sendMessages(msgArray);
'Console.WriteLine(msgArray[0]);
'Console.WriteLine(msgArray[1]);
Console.WriteLine("Press <ENTER> to
terminate...")
Console.In.ReadLine()
srv.stopService()
com4.Stop()
Catch e As Exception
Console.WriteLine(e.Message)
Console.WriteLine(e.StackTrace)
Console.In.ReadLine()
End Try
End Sub
End Class
End Namespace
--
You received this message because you are subscribed to the Google Groups
"SMSLib User Group" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/smslib?hl=en.