MAC Address Detecting Menubar App

  • I'm fairly new to Cocoa, so I'll try not to sound like too much of a
    n00b here, but... I'd like to build a menubar application which will
    change icons dependent upon whether a certain MAC address is present
    on the local network. So far, I've assembled SystemUIPlugin and
    MenuExtraView Classes, but I'm not sure where to proceed from here.

    --
    Jordan Chark
    <jordan.chark...>
    http://jordanchark.com
  • > I'm fairly new to Cocoa, so I'll try not to sound like too much of a
    > n00b here, but... I'd like to build a menubar application which will
    > change icons dependent upon whether a certain MAC address is present
    > on the local network. So far, I've assembled SystemUIPlugin and
    > MenuExtraView Classes, but I'm not sure where to proceed from here.

      The only thing "n00b" is the clarity of your question. The rest is
    perfectly valid. ;-)

      Specifically, are you asking a) how to create a menu extra / status
    item, or b) how to detect the presence of a MAC address?

      Regarding "a", there are *lots* of sources (including this list's
    archives), so if you run into trouble, ask a specific question,
    otherwise, read, read, read.

      Regarding "b", I've never done this, but it seems you'd have to
    resort to 'polling' (repeatedly checking for something at regular
    intervals). Polling generates a lot of unnecessary overhead (in the
    case of a network, traffic). So ... that begs the question: what are
    you really trying to accomplish (in general)?

      If you want to detect a certain computer, you might look into
    Bonjour services. If you know other computers will be running your
    software, just announce via Bonjour.

      If on the other hand, you want to simply see if *any* computer
    (regardless of type, or software it's running), you're getting into
    some pretty involved stuff with a lot of "gotcha's" and sharp teeth
    for a beginner.

      With that in mind, you might want to clarify your post by clearly
    stating your specific goal and specific questions you have *after*
    reading all available material you can find on the two subjects you
    raised. Come with specific questions and you'll get specific answers.
    ;-)

    --
    I.S.
  • Thanks for the lengthy answer. :)

    To answer your first question, I'm sorta asking how to create an extra
    menu/status item which will change icons based on the presence of a
    computer detecting using Bonjour. Well, specifically, I'm looking to
    create a very simple application, which would show one icon when a
    certain computer is on the network, and show another when it's not. In
    terms of polling, Bonjour would probably be a better option. The
    computer I'm looking to detect is also a Mac, which is probably easier
    to accomplish as on PCs I was thinking some client-side software may
    be needed (unless it'd be done with Samba).

    The main reason I emailed this list, is that I did plenty of reading,
    and got into that scary gotcha business, and thought maybe you guys
    could help out. Even though this has taken a bit of a different
    direction now, I'd really appreciate some guidance in relation to
    creating this app. Also, even though I am quite the n00b, don't be
    afraid to throw some terminology/code my way- I've done my fair share
    of reading/practice.

    On Nov 19, 2007, at 1:26 PM, I. Savant wrote:

    >> I'm fairly new to Cocoa, so I'll try not to sound like too much of a
    >> n00b here, but... I'd like to build a menubar application which will
    >> change icons dependent upon whether a certain MAC address is present
    >> on the local network. So far, I've assembled SystemUIPlugin and
    >> MenuExtraView Classes, but I'm not sure where to proceed from here.
    >
    > The only thing "n00b" is the clarity of your question. The rest is
    > perfectly valid. ;-)
    >
    > Specifically, are you asking a) how to create a menu extra / status
    > item, or b) how to detect the presence of a MAC address?
    >
    > Regarding "a", there are *lots* of sources (including this list's
    > archives), so if you run into trouble, ask a specific question,
    > otherwise, read, read, read.
    >
    > Regarding "b", I've never done this, but it seems you'd have to
    > resort to 'polling' (repeatedly checking for something at regular
    > intervals). Polling generates a lot of unnecessary overhead (in the
    > case of a network, traffic). So ... that begs the question: what are
    > you really trying to accomplish (in general)?
    >
    > If you want to detect a certain computer, you might look into
    > Bonjour services. If you know other computers will be running your
    > software, just announce via Bonjour.
    >
    > If on the other hand, you want to simply see if *any* computer
    > (regardless of type, or software it's running), you're getting into
    > some pretty involved stuff with a lot of "gotcha's" and sharp teeth
    > for a beginner.
    >
    > With that in mind, you might want to clarify your post by clearly
    > stating your specific goal and specific questions you have *after*
    > reading all available material you can find on the two subjects you
    > raised. Come with specific questions and you'll get specific answers.
    > ;-)
    >
    > --
    > I.S.
  • On Nov 20, 2007 8:46 AM, Jordan Chark <jordan.chark...> wrote:
    > Thanks for the lengthy answer. :)
    >
    > To answer your first question, I'm sorta asking how to create an extra
    > menu/status item which will change icons based on the presence of a
    > computer detecting using Bonjour.

    For setting the menu bar, stick this somewhere in your app's controller:

    sbItem = [[NSStatusBar systemStatusBar]
    statusItemWithLength:NSVariableStatusItemLength];
    [sbItem retain];
    [sbItem setHighlightMode:YES];
    [sbItem setImage:sbImage];
    [sbItem setMenu:sbMenu];

    You'll probably want some kind of menu coming out of your status bar
    icon, which is what sbMenu is meant to be an outlet for. You can call
    -setImage: at any time, which will make your icon change.

    Dave.
  • > The main reason I emailed this list, is that I did plenty of reading,
    > and got into that scary gotcha business, and thought maybe you guys
    > could help out. Even though this has taken a bit of a different
    > direction now, I'd really appreciate some guidance in relation to
    > creating this app. Also, even though I am quite the n00b, don't be
    > afraid to throw some terminology/code my way- I've done my fair share
    > of reading/practice.

      Okay, so what "gotcha" stuff have you run into? Again, you need to
    be specific. I recommend reading this:

    http://www.catb.org/~esr/faqs/smart-questions.html

      This *isn't* an insult, but you really do need to pay attention to
    its lessons if you want help on a technical mailing list. You're
    asking a very vague question that would require a small book or large
    tutorial to answer. Break it down into small, pointed questions.

    --
    I.S.
  • On Nov 19, 2007 1:46 PM, Jordan Chark <jordan.chark...> wrote:

    > Well, specifically, I'm looking to
    > create a very simple application, which would show one icon when a
    > certain computer is on the network, and show another when it's not.

    Consider...

    <http://developer.apple.com/documentation/Networking/Conceptual/SystemConfig
    Frameworks/SC_ReachConnect/chapter_5_section_1.html
    >

    -Shawn
  • On Nov 19, 2007, at 1:46 PM, Jordan Chark wrote:

    > The computer I'm looking to detect is also a Mac, which is probably
    > easier to accomplish as on PCs I was thinking some client-side
    > software may be needed (unless it'd be done with Samba).

    If you choose to implement this this functionality using Bonjour, note
    that any client-side software for Windows could be implemented using
    the same technology:

    <http://developer.apple.com/networking/bonjour/index.html>

    Also note that Cocoa provides two classes for working with Bonjour
    services and service discovery: NSNetService and NSNetServiceBrowser.
    There's a bit of sample code here:

    </Developer/Examples/Foundation/PictureSharing>

    j o a r
previous month november 2007 next month
MTWTFSS
      1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30    
Go to today