AirPort & SCF question (X)
AirPort & SCF question (X)
- Subject: AirPort & SCF question (X)
- From: Joe Kelly <email@hidden>
- Date: Mon, 11 Feb 2002 11:29:35 -0800
I am using MoreSCF (d3), and I am creating a new location with an active
network port specified by the user. It's all good when the user chooses
"Built-in Ethernet" -- I make that particular service active for the
location, and enable DHCP for that port.
When the user chooses "AirPort" (and actually has an airport card & base
station : ), the code runs without error, but when I open up the network
settings pane, the new location shows up as using "Built-In Ethernet", all
other network ports are not active. Ultimately, I would want it to make
Airport the current port with DHCP client enabled (and no other ports
[services] enabled for that location).
Briefly, this is what I'm doing (err code removed):
MoreSCNewSet(homeSetID, &newSetID);
MoreSCSetCurrentSet(newSetID);
MoreSCCopyServiceIDs(newSetID, &serviceIDs, nil);
setCount = CFArrayGetCount(serviceIDs);
for (i = 0 ; i < setCount; i++) // iterate services, looking for one that
matches requested port
{
Boolean isActive;
Boolean isAirport;
MoreSCCopyUserVisibleNameOfService(newSetID,
CFArrayGetValueAtIndex(serviceIDs, i), &userVis);
MoreSCIsServiceActive(newSetID,
CFArrayGetValueAtIndex(serviceIDs, i), &isActive);
// Is this the port the user requested?
//
if (CFStringCompare(portName, userVis, kCFCompareCaseInsensitive) ==
kCFCompareEqualTo)
{
CFMutableDictionaryRef theEntity = nil;
if (!isActive) // turn it on if it's off.
{
MoreSCSetServiceActive(newSetID,CFArrayGetValueAtIndex(serviceIDs, i),
true);
}
MoreSCCopyEntityMutable(newSetID, CFArrayGetValueAtIndex(serviceIDs,
i), kSCEntNetIPv4, &theEntity);
if (theEntity)
{
CFDictionaryReplaceValue(theEntity, kSCPropNetIPv4ConfigMethod,
kSCValNetIPv4ConfigMethodDHCP);
MoreSCSetEntity(newSetID, CFArrayGetValueAtIndex(serviceIDs, i),
kSCEntNetIPv4, theEntity);
CFRelease(theEntity);
}
}
}
else // this must be some other service (ie: Internal
modem). Turn it off.
{
MoreSCSetServiceActive(newSetID,CFArrayGetValueAtIndex(serviceIDs,
i), false);
}
CFRelease(userVis);
userVis = nil;
}
thanks
joe
_______________________________________________
macnetworkprog mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/macnetworkprog
Do not post admin requests to the list. They will be ignored.