Sorry guys, I figured it out - the signal handler class needs to implement 
AJNSignalHandler and synthesize the handle - then I can register it as the 
handler.

Still curious if there are iOS tutorials for setting up a signal handler for 
auto generated code.

Do you guys pay people to update your documentation? Kinda kidding... but not 
really.

We were able to get our alljoyn project up and running on Xcode 7 on iOS 9.1 
and 9.2.

-Jeff

From: Jeffrey Blayney <[email protected]<mailto:[email protected]>>
Date: Wednesday, January 6, 2016 at 2:16 PM
To: 
"[email protected]<mailto:[email protected]>"
 
<[email protected]<mailto:[email protected]>>
Cc: "Akre, David" <[email protected]<mailto:[email protected]>>
Subject: Signals in iOS ObjC code generation

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)

voidCanvasObjectDelegateSignalHandlerImpl::NewMeshCanvasItemSignalHandler(constajn::InterfaceDescription::Member*
 member, const char* srcPath, ajn::Message& msg)

{

    @autoreleasepool {



    uint32_t inArg0 = msg->GetArg(0)->v_uint32;



        AJNMessage *signalMessage = [[AJNMessagealloc] initWithHandle:&msg];

        NSString *objectPath = [NSStringstringWithCString: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_delegatedidReceive:[NSNumbernumberWithUnsignedInt:inArg0]
 inSession:sessionId message:signalMessage];



        });



    }

}



@implementation AJNBusAttachment(CanvasObjectDelegate)


- 
(void)registerCanvasObjectDelegateSignalHandler:(id<CanvasObjectDelegateSignalHandler>)signalHandler

{

    CanvasObjectDelegateSignalHandlerImpl *signalHandlerImpl = 
newCanvasObjectDelegateSignalHandlerImpl(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

     */

    [selfregisterSignalHandler:signalHandler];

}


@end


_______________________________________________
Allseen-core mailing list
[email protected]
https://lists.allseenalliance.org/mailman/listinfo/allseen-core

Reply via email to