Exemplo n.º 1
0
        public void EnableConcurrentCallbacks_Not_Used()
        {
            AllJoyn.QStatus status = AllJoyn.QStatus.FAIL;
            callbackStatus         = AllJoyn.QStatus.FAIL;
            listenerRegisteredFlag = false;
            nameOwnerChangedFlag   = false;

            mbus = new AllJoyn.BusAttachment("BusListenerTest", true);
            AllJoyn.BusListener busListener = new BusListenerWithBlockingCall(this);

            // start the bus attachment
            status = mbus.Start();
            Assert.Equal(AllJoyn.QStatus.OK, status);

            // connect to the bus
            status = mbus.Connect(AllJoynTestCommon.GetConnectSpec());
            Assert.Equal(AllJoyn.QStatus.OK, status);

            mbus.RegisterBusListener(busListener);
            Wait(MaxWaitTime);
            Assert.True(listenerRegisteredFlag);

            mbus.RequestName(ObjectName, 0);
            Wait(MaxWaitTime);
            Assert.True(nameOwnerChangedFlag);

            /*
             * Because of the way that callback functions are defered we can still make
             * what would be a blocking call in alljoyn_core and it is not a blocking
             * call in Unity.  This is a by product of the alljoyn_c deffered callback class
             * and its usage.  I am still investigating ways to work around issues caused
             * by the deffered callback class at some point in the future may start to work
             * as alljoyn_core.
             * Assert.Equal(AllJoyn.QStatus.BUS_BLOCKING_CALL_NOT_ALLOWED, callbackStatus);
             */
            Assert.Equal(AllJoyn.QStatus.OK, callbackStatus);
            mbus.UnregisterBusListener(busListener);
            mbus.Stop();
            mbus.Join();
            mbus.Dispose();
        }
		public void EnableConcurrentCallbacks_Not_Used()
		{
			AllJoyn.QStatus status = AllJoyn.QStatus.FAIL;
			callbackStatus = AllJoyn.QStatus.FAIL;
			listenerRegisteredFlag = false;
			nameOwnerChangedFlag = false;

			mbus = new AllJoyn.BusAttachment("BusListenerTest", true);
			AllJoyn.BusListener busListener = new BusListenerWithBlockingCall(this);

			// start the bus attachment
			status = mbus.Start();
			Assert.Equal(AllJoyn.QStatus.OK, status);

			// connect to the bus
			status = mbus.Connect(AllJoynTestCommon.GetConnectSpec());
			Assert.Equal(AllJoyn.QStatus.OK, status);

			mbus.RegisterBusListener(busListener);
			Wait(MaxWaitTime);
			Assert.True(listenerRegisteredFlag);

			mbus.RequestName(ObjectName, 0);
			Wait(MaxWaitTime);
			Assert.True(nameOwnerChangedFlag);
			/*
			 * Because of the way that callback functions are defered we can still make
			 * what would be a blocking call in alljoyn_core and it is not a blocking
			 * call in Unity.  This is a by product of the alljoyn_c deffered callback class
			 * and its usage.  I am still investigating ways to work around issues caused
			 * by the deffered callback class at some point in the future may start to work
			 * as alljoyn_core.
			 * Assert.Equal(AllJoyn.QStatus.BUS_BLOCKING_CALL_NOT_ALLOWED, callbackStatus);
			 */
			Assert.Equal(AllJoyn.QStatus.OK, callbackStatus);
			mbus.UnregisterBusListener(busListener);
			mbus.Stop();
			mbus.Join();
			mbus.Dispose();
		}