Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > C# and C > C# 2005 > C# 2005
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
C# 2005 For discussion of Visual C# 2005.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C# 2005 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Search this Thread Display Modes
  #11 (permalink)  
Old March 8th, 2006, 06:50 AM
Authorized User
 
Join Date: Mar 2006
Location: , , .
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Tried it out ..still no luck ..can you send me your sample code pls ...my email id is rsrika@gmail.com

  #12 (permalink)  
Old March 8th, 2006, 09:46 AM
Authorized User
 
Join Date: Mar 2006
Location: , , .
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I was able to get it working ....

How do i handle the AT Commands for international SMS ..say for example ..my mobile no is 9840705667..how would i add my country code before it ..say ...+919840705667...where "91" is the country code for india ....



  #13 (permalink)  
Old March 8th, 2006, 08:46 PM
Friend of Wrox
Points: 2,376, Level: 20
Points: 2,376, Level: 20 Points: 2,376, Level: 20 Points: 2,376, Level: 20
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: , , Australia.
Posts: 596
Thanks: 1
Thanked 3 Times in 3 Posts
Default

Well done, I dont know about international, best to just try some trial and error

======================================
They say, best men are molded out of faults,
And, for the most, become much more the better
For being a little bad.
======================================
  #14 (permalink)  
Old March 9th, 2006, 01:36 AM
Friend of Wrox
Points: 2,376, Level: 20
Points: 2,376, Level: 20 Points: 2,376, Level: 20 Points: 2,376, Level: 20
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: , , Australia.
Posts: 596
Thanks: 1
Thanked 3 Times in 3 Posts
Default

Out of interest, what was wrong with your code.

======================================
They say, best men are molded out of faults,
And, for the most, become much more the better
For being a little bad.
======================================
  #15 (permalink)  
Old March 14th, 2006, 05:42 AM
Authorized User
 
Join Date: Mar 2006
Location: , , .
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I had to add the security permissions...

  #16 (permalink)  
Old March 14th, 2006, 05:48 AM
Authorized User
 
Join Date: Mar 2006
Location: , , .
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Default

is there any way i can read the responses of the AT Commands.

  #17 (permalink)  
Old March 14th, 2006, 06:14 AM
Friend of Wrox
Points: 2,376, Level: 20
Points: 2,376, Level: 20 Points: 2,376, Level: 20 Points: 2,376, Level: 20
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: , , Australia.
Posts: 596
Thanks: 1
Thanked 3 Times in 3 Posts
Default

You have to wire the event for it.
          
Code:
  serialPort.DataReceived += new SerialDataReceivedEventHandler(serialPort_DataReceived);


And then extract the data from the event by string manipulation.
This is my code to estract SMSInbox info, you may beed to tweek it for your needs.

No garentees as I just cut this straight out the page, but I sure you can get going from here

Code:
       
void serialPort_DataReceived(object sender, SerialDataReceivedEventArgs e)
        {
            string line;
            int i = 0;
            SerialPort pt = (SerialPort)sender;
            line = pt.ReadExisting();
            //Extract the new message ID's from the returned data string.
            ////+CMGL: 290, "REC READ", "+614030****"
            ////TESTING 1,2,3
            while (line.IndexOf("+CMGL:", i) > 0)
            {
                BubbleMessageEvent("New Message received", EventLogEntryType.Information);
                //Get the line starting with +CMGL
                int startIndex = line.IndexOf("+CMGL:", i);
                //Find the next +GMGL after the last one
                int endIndex = line.IndexOf("+CMGL:", startIndex + 1);
                //if there isn't another +CMGL, then the end of the line is the end of the info
                if (endIndex <= 0) { endIndex = line.Length; }
                //The current message is from the first +CMGL to the next or eof
                string msg = line.Substring(startIndex, endIndex - startIndex);

                //Find the phone number componenet of the message
                string [] msgComponents = msg.Split(',');
                string msgNumber =  msgComponents[2];
                int endNumIndex = msgNumber.IndexOf("\r\n");
                if (endNumIndex <= 0) { endNumIndex = msgNumber.Length; }

                msgNumber = msgNumber.Substring(0,endNumIndex + 1);

                //Find the message componenet of the sms receive notification
                //The message part starts after a new line
                int startMsgIndex = msg.IndexOf("\r\n");
                //The end of the message is before the next new line
                int endMsgIndex = msg.IndexOf("\r\n", startMsgIndex + 1);
                //if there is not a new line then the end of the message is the end of the text
                if (endMsgIndex <= 0) { endMsgIndex = msg.Length; }

                string msgText = msg.Substring(startMsgIndex, endMsgIndex - startMsgIndex);

                ProcessNewMessage(msgText, msgNumber);
                i = startIndex + 1;
            }

        }
Good Luck


======================================
They say, best men are molded out of faults,
And, for the most, become much more the better
For being a little bad.
======================================
  #18 (permalink)  
Old March 14th, 2006, 06:26 AM
Friend of Wrox
Points: 2,376, Level: 20
Points: 2,376, Level: 20 Points: 2,376, Level: 20 Points: 2,376, Level: 20
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: , , Australia.
Posts: 596
Thanks: 1
Thanked 3 Times in 3 Posts
Default

All responses will come through this event.

======================================
They say, best men are molded out of faults,
And, for the most, become much more the better
For being a little bad.
======================================
  #19 (permalink)  
Old June 8th, 2006, 05:22 AM
Registered User
 
Join Date: Apr 2006
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

My mobile cam only send SMS in PDU format, at+cgmf=0, how I can convert textbox with number and message to PDU ??
Thanks !

  #20 (permalink)  
Old June 8th, 2006, 09:21 PM
Friend of Wrox
Points: 2,376, Level: 20
Points: 2,376, Level: 20 Points: 2,376, Level: 20 Points: 2,376, Level: 20
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: , , Australia.
Posts: 596
Thanks: 1
Thanked 3 Times in 3 Posts
Default

Hi Atila,
I have not had any experience with PDU unfortunately.
As this thread is getting quite long you may be better off starting this question as a new thread.
Good Luck,
Rod


======================================
They say, best men are molded out of faults,
And, for the most, become much more the better
For being a little bad.
======================================
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
USB Port kanoorani Beginning VB 6 8 August 12th, 2009 04:28 PM
Accessing USB and Serial Port through Java taraprasad Pro JSP 3 April 10th, 2008 06:20 AM
.Net problem with emulated USb to Serial com port Turbovulc General .NET 0 April 5th, 2007 06:18 AM
communicating with usb port Lookie VB How-To 1 March 2nd, 2005 11:53 PM
Usb Port? dedex C# 1 November 9th, 2004 06:14 AM



All times are GMT -4. The time now is 12:08 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.