Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > Mac OS X Development Forums > Objective-C, Python, Ruby Development

Reply
 
LinkBack Thread Tools Display Modes
Old 09-10-2009, 03:19 PM   #1 (permalink)
Registered Member
 
Join Date: Mar 2009
Location: I'm a Brit-pat.
Posts: 171
coulls is on a distinguished road
Default NSNumber to NSString of binary

Hi All,

I have a simple question that I seem to be tying myself up in knots over.

I'll answer the "why" first, as I'm sure it'll come up: I'm parsing NMEA data for an AIVDM message, which has 6bit binary encoded as ASCII gibberish. I need to reverse the process, then break down the bits into chunks to get things like ship name, bearing, speed, etc.

Now, having explained the why, here's the question:
Is there a Cocoa way to take an NSNumber and convert this to a string representing the binary digits, or should I stop trying to use straight Cocoa and just hack it in C?

I tried looking at NSNumberFormatter, but that didn't have the binary option, so is there another way?

Thanks,

Jase
coulls is offline   Reply With Quote
Old 09-10-2009, 06:06 PM   #2 (permalink)
Former NeXTStep Developer
 
Join Date: Mar 2009
Posts: 997
FlyingDiver will become famous soon enough
Default

I don't recall seeing anything for generating binary (0s and 1s) strings, so if you really need that you'll probably have to write it yourself.

Also, if you're getting that NMEA data through some sort of serial data connection, I'd probably start with an NSData buffer rather than an intermediate NSNumber representation. Converting from the byte-oriented data stream to NSNumber objects seems like extra overhead.

joe
FlyingDiver is offline   Reply With Quote
Old 09-10-2009, 09:29 PM   #3 (permalink)
Registered Member
 
Join Date: Mar 2009
Location: I'm a Brit-pat.
Posts: 171
coulls is on a distinguished road
Default

Hi there,

thanks - I will try that. Will post solution if I find it...

Cheers

Jason
coulls is offline   Reply With Quote
Reply

Bookmarks

Tags
binary, format, nsnumber

Thread Tools
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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 458
13 members and 445 guests
Domele, Duncan C, Feldspar, MacBook MH, Objective Zero, patapple, peterwilli, pipposanta, PixelInteractive, Punkjumper, SLIC, taylor202, Today's Posts
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,694
Threads: 94,137
Posts: 402,950
Top Poster: BrianSlick (7,990)
Welcome to our newest member, peterwilli
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 01:03 PM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0