Hello,
Let me know if I should create a forum post instead or use another means of
getting help. My question is about finding iOS signal documentation.
I am creating an AllJoyn application on iOS. I have an interface definition
that includes a signal. I've put this interface through the the code generator
tool to create my objects. It works well, and it created objective-c method
stubs for my methods, and I am able to send the signal. One thing that it does
not create is an objective-c method stub for the "didReceive" for the receiving
side of the signal.
I cannot find any documentation specifically for iOS/objc on the allseen site
that clarifies how to setup or handle signals. The tutorial for iOS that
includes code generation clearly outlines methods - but no signals.
Is there any documentation on this that could help me create an objective-c
method stub for "didReceive"?
Any direction would be appreciated. In case it will help - here is some code:
Calling: [bus registerCanvasObjectDelegateSignalHandler: self]
>From a class that implements "CanvasObjectDelegateSignalHandler" always
>crashes - see my comments in the code below.
Here is a snippet of the generated code from AJNCanvasObject.mm with added
comments.
// This is my signal handler - (auto generated code)
void
CanvasObjectDelegateSignalHandlerImpl::NewMeshCanvasItemSignalHandler(const
ajn::InterfaceDescription::Member* member, const char* srcPath, ajn::Message&
msg)
{
@autoreleasepool {
uint32_t inArg0 = msg->GetArg(0)->v_uint32;
AJNMessage *signalMessage = [[AJNMessage alloc] initWithHandle:&msg];
NSString *objectPath = [NSString stringWithCString:msg->GetObjectPath()
encoding:NSUTF8StringEncoding];
AJNSessionId sessionId = msg->GetSessionId();
NSLog(@"Received NewMeshCanvasItem signal from %@ on path %@ for
session id %u [%s > %s]", [signalMessage senderName], objectPath,
msg->GetSessionId(), msg->GetRcvEndpointName(), msg->GetDestination() ?
msg->GetDestination() : "broadcast");
dispatch_async(dispatch_get_main_queue(), ^{
//This is where it calls the delegate that I'm supposed to register somehow
using the method below.
[(id<CanvasObjectDelegateSignalHandler>)m_delegate
didReceive:[NSNumber numberWithUnsignedInt:inArg0] inSession:sessionId
message:signalMessage];
});
}
}
@implementation AJNBusAttachment(CanvasObjectDelegate)
-
(void)registerCanvasObjectDelegateSignalHandler:(id<CanvasObjectDelegateSignalHandler>)signalHandler
{
CanvasObjectDelegateSignalHandlerImpl *signalHandlerImpl = new
CanvasObjectDelegateSignalHandlerImpl(signalHandler);
//This crashes - my class that implements CanvasObjectDelegateSignalHandler
doesn't have a handle variable.
//This leads me to believe I'm improperly implementing my signal handler
class - but there are no iOS examples anywhere.
signalHandler.handle = signalHandlerImpl; //Error "Thread 1: signal
SIGABRT" and "unrecognized signal sent to instance"
/**
The below code registers the signal handler on the bus to be called when
the signal is received.
One thing that is odd is it assumes the signalHandler is of type:
ajn::BusAttachment in the registerSignalHandler
Method although it comes in as type:
CanvasObjectDelegateSignalHandler which is a protocol deriving from type:
AJNSignalHandler
*/
[self registerSignalHandler:signalHandler];
}
@end
_______________________________________________
Allseen-core mailing list
[email protected]
https://lists.allseenalliance.org/mailman/listinfo/allseen-core