GPRS Shield - Netduino Plus 2 (and Netduino Plus 1) - Netduino Forums
   
Netduino home hardware projects downloads community

Jump to content


The Netduino forums have been replaced by new forums at community.wildernesslabs.co. This site has been preserved for archival purposes only and the ability to make new accounts or posts has been turned off.
Photo

GPRS Shield


  • Please log in to reply
3 replies to this topic

#1 yetanothernetduino

yetanothernetduino

    New Member

  • Members
  • Pip
  • 7 posts

Posted 04 April 2013 - 01:21 PM

Hi,

I am using this code

http://netduino2seedgsm.codeplex.com/

 

and this hardware

http://www.seeedstud...l?cPath=132_134

 

Managed to send sms ok however reading all SMS have been no joy.

 

Just wondering y whthe visual studio output produces funny characters: eg AÕi5GªA,j etc etc even thought the code is converted byte[] from utf8 string.

 

 

  private static string GetUTF8StringFrombytes(byte[] byteVal)
  {
  byte[] btOne = new byte[1];
  StringBuilder sb = new StringBuilder("");
  char uniChar;
  for (int i = 0; i < byteVal.Length; i++)
  {
  btOne[0] = byteVal[i];
  if (btOne[0] > 127)
  {
  uniChar = Convert.ToChar(btOne[0]);
  sb.Append(uniChar);
  Debug.Print(uniChar.ToString());
  }
  else
  {
  sb.Append(new string(Encoding.UTF8.GetChars(btOne)));
  Debug.Print(new string(Encoding.UTF8.GetChars(btOne)));
  }
  }
  return sb.ToString();
  }
  }

 

 



#2 j2inet

j2inet

    Member

  • Members
  • PipPip
  • 11 posts

Posted 05 April 2013 - 03:59 PM

Hi,

I am using this code

http://netduino2seedgsm.codeplex.com/

 

and this hardware

http://www.seeedstud...l?cPath=132_134

 

Managed to send sms ok however reading all SMS have been no joy.

 

Just wondering y whthe visual studio output produces funny characters: eg AÕi5GªA,j etc etc even thought the code is converted byte[] from utf8 string.

 

Have you taken a look at the byte stream that has come back to verify that the problem isn't in the data itself? The range of the byte values you get back should be between 0x20(32) and 0x7E (126~) if you are getting back plain english text. If you see your values are outside this range then the problem isn't with your conversion, it's with the data itself.  



#3 yetanothernetduino

yetanothernetduino

    New Member

  • Members
  • Pip
  • 7 posts

Posted 21 April 2013 - 01:57 PM

Even if the data is in in that format, is the a conversion out there?

 

Because it's kind of useless to read sms that are unreadable to human.

 

I am sure someone out there would having this kind of this issue?



#4 ziggurat29

ziggurat29

    Advanced Member

  • Members
  • PipPipPip
  • 244 posts

Posted 21 April 2013 - 03:02 PM

its not clear to me why you need to do all the work you are doing in:

  private static string GetUTF8StringFrombytes(byte[] byteVal){}

I think any call to that can be replaced simply with:

  new string(Encoding.UTF8.GetChars(byteVal)

 

That being said, be aware that Encoding.UTF8.GetChars() will throw if the bytes are not valid UTF.  This can easily happen if what you are getting back is garbage to begin with, so use a try block if you care about robustness.

 

I have used the SIM900-based module successfully, though I do not use it for SMS, so I can't give advice on that feature.






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

home    hardware    projects    downloads    community    where to buy    contact Copyright © 2016 Wilderness Labs Inc.  |  Legal   |   CC BY-SA
This webpage is licensed under a Creative Commons Attribution-ShareAlike License.