Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7778015
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T18:17:23+00:00 2026-06-01T18:17:23+00:00

Good morning, I am retrieving a stream of bytes from a serial device that

  • 0

Good morning,

I am retrieving a stream of bytes from a serial device that connects to the iPad. Once connected the supplied SDK will call a delegate method with the bytes that have been forwarded.

The readings forwarded by the serial device via the SDK are in the following format:

!X1:000.0;

Once connected to the serial device the delegated methods will start receiving data immediately – this could be in various states of completion i.e.

:000.00;

What I need to do is establish a concrete way of splitting the readings returned from the serial device so that I can manipulate the data.

Some of the tried options are:

Simply concatenate the received strings for a fixed period and then split the NSString on the “;” character. This is a little inefficient though and does not allow me to manipulate the data dynamically

-(void)receivingDelegateMethod:(NSString *)aString    {
      if(counter < 60){
          [self.PropertyString stringByAppendingString:aString];
      }else{
          NSArray *readings = [self.PropertyString componentsSeparatedByString: @";"];
      }    
}

Determine a starting point by looking for the “!” character and then appending the resulting substring to a NSString property. All previous calls to the delegated method will append to this property and then remove the first 10 characters.

I know there are further options such as NSScanners and RegEx but I wanted to get the opinion of the community before wasting more time of different methods.

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T18:17:26+00:00Added an answer on June 1, 2026 at 6:17 pm

    Make a BOOL flag that indicates that the stream has been initialized, and set it to false. When you receive the next chunk of data, check the flag first. If it is not set, skip all characters until you see an exclamation point '!'. Once you see it, discard everything in front of it, and copy the rest of the string into the buffer. If the “is initialized” flag is set, append the entire string to the buffer without skipping characters.

    Once you finish the append, scan the buffer for ! and ; delimited sections. For each occurrence of that pattern, call a designated method with a complete portion of the pattern. You can get fancy, and define your own “secondary” delegate for processing pre-validated strings.

    You may need to detect disconnections, and set the “is initialized” flag back to NO.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Good morning. Take this simple scenario: I've got a NetClient that connects itself to
Good Morning All, I have an Objective C question that is coming from JavaScript.
Good morning, I am currently developing a java web application that exposes a web
Good morning gang. I have a jQuery Datepicker object that is prepoulated using a
Good morning ! What is the best way to remove duplicate records from grid
Good morning, I'm having a really annoying issue with Highcharts, such that the x-axis
Good Morning Stackoverflow-ka-teers, I am creating a raffle form that allows you to enter
Good morning! I'm programming a managment aplication that shows a task list using WPF
Good Morning, I have copied this code from somewere <script type=text/javascript> $(function() { setInterval(rotateImages(),
Good morning. I have a modal JQuery dialog that on Open calls and loads

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.