gurux.sms.java

gurux.sms.java package implements class that can be used to send and receive Short Messages (SMS) using phone or modem.

License

License

GroupId

GroupId

org.gurux
ArtifactId

ArtifactId

gurux.sms
Last Version

Last Version

1.0.20
Release Date

Release Date

Type

Type

jar
Description

Description

gurux.sms.java
gurux.sms.java package implements class that can be used to send and receive Short Messages (SMS) using phone or modem.
Project URL

Project URL

http://www.gurux.org
Project Organization

Project Organization

Gurux Ltd.
Source Code Management

Source Code Management

https://github.com/gurux/gurux.sms.java

Download gurux.sms

How to add to project

<!-- https://jarcasting.com/artifacts/org.gurux/gurux.sms/ -->
<dependency>
    <groupId>org.gurux</groupId>
    <artifactId>gurux.sms</artifactId>
    <version>1.0.20</version>
</dependency>
// https://jarcasting.com/artifacts/org.gurux/gurux.sms/
implementation 'org.gurux:gurux.sms:1.0.20'
// https://jarcasting.com/artifacts/org.gurux/gurux.sms/
implementation ("org.gurux:gurux.sms:1.0.20")
'org.gurux:gurux.sms:jar:1.0.20'
<dependency org="org.gurux" name="gurux.sms" rev="1.0.20">
  <artifact name="gurux.sms" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.gurux', module='gurux.sms', version='1.0.20')
)
libraryDependencies += "org.gurux" % "gurux.sms" % "1.0.20"
[org.gurux/gurux.sms "1.0.20"]

Dependencies

compile (1)

Group / Artifact Type Version
org.gurux : gurux.common jar 1.0.17

test (1)

Group / Artifact Type Version
junit : junit jar 4.12

Project Modules

There are no modules declared in this project.

See An Gurux for an overview.

Join the Gurux Community or follow @Gurux for project updates.

Open Source GXSMS (Short Message Service) media component, made by Gurux Ltd, is a part of GXMedias set of media components, which programming interfaces help you implement communication by chosen connection type. Gurux media components also support the following connection types: network (TCP/IP and UDP), serial port and terminal.

For more info check out Gurux.

We are updating documentation on Gurux web page.

If you have problems you can ask your questions in Gurux Forum.

Build

If you want to build example you need Nuget package manager for Visual Studio. You can get it here: https://visualstudiogallery.msdn.microsoft.com/27077b70-9dad-4c64-adcf-c7cf6bc9970c

Simple example

Before use you must set following settings:

  • PhoneNumber
  • PortName
  • BaudRate
  • DataBits
  • Parity
  • StopBits
  • Pin code

It is also good to listen following events:

  • OnError
  • OnReceived
GXSMS cl = new GXSMS();
cl.PhoneNumber = "Phone number";
cl.PortName = "COM1";
cl.BaudRate = 9600;
cl.DataBits = 8;
cl.Parity = System.IO.Ports.Parity.None;
cl.StopBits = System.IO.Ports.StopBits.One;
cl.Open();

SMS message is send with send command:

Gurux.SMS.GXSMSMessage msg = new Gurux.SMS.GXSMSMessage();
msg.Data = "Hello World!";
msg.Number = "Phone number";
cl.Send(msg);

In default mode received SMS message is coming as asynchronously from OnReceived event.

cl.OnReceived += new ReceivedEventHandler(this.OnReceived);
/// <summary>
/// Show received SMS message.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>        
private void cl_OnReceived(object sender, ReceiveEventArgs e)
{
	try
	{
        GXSMSMessage msg = e.Data as GXSMSMessage;
        ListViewItem it = MsgList.Items.Add(msg.Data);
        it.SubItems.Add(msg.PhoneNumber);
        it.SubItems.Add(msg.Time.ToString());
	}
    catch (Exception ex)
    {
        MessageBox.Show(ex.Message);
    }
}

Data can be send as syncronous if needed:

lock (cl.Synchronous)
{
	Gurux.SMS.GXSMSMessage msg = new Gurux.SMS.GXSMSMessage();
	msg.Data = "Hello World!";
	msg.Number = "Phone number";
	cl.Send(msg);
	//Wait answer for 60 seconds.
	Gurux.SMS.GXSMSMessage reply = cl.Receive(60)
}
org.gurux

Gurux Ltd

Versions

Version
1.0.20
1.0.19
1.0.18
1.0.17
1.0.16
1.0.15
1.0.14
1.0.13
1.0.11
1.0.9
1.0.8
1.0.7
1.0.6
1.0.5
1.0.3