diff --git a/README.md b/README.md
index f833841027..107e6a5cad 100644
--- a/README.md
+++ b/README.md
@@ -268,75 +268,72 @@ For additional Windows samples, see [Windows on GitHub](http://microsoft.github.
-### Devices and sensors
+### Devices, sensors, and power
@@ -450,14 +447,15 @@ For additional Windows samples, see [Windows on GitHub](http://microsoft.github.
Lock screen personalization
Microsoft Passport and Windows Hello
- Smart cards
+ Personal Data Encryption
+ Smart cards
User information
UserCertificateStore
- UserConsentVerifier
+ UserConsentVerifier
Web account management
WebAuthenticationBroker
diff --git a/Samples/AllJoyn/Common/Scenario1WinRTComponent/AllJoynHelpers.h b/Samples/AllJoyn/Common/Scenario1WinRTComponent/AllJoynHelpers.h
deleted file mode 100644
index 360af60c5d..0000000000
--- a/Samples/AllJoyn/Common/Scenario1WinRTComponent/AllJoynHelpers.h
+++ /dev/null
@@ -1,277 +0,0 @@
-//*********************************************************
-//
-// Copyright (c) Microsoft. All rights reserved.
-// This code is licensed under the MIT License (MIT).
-// THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
-// ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
-// IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
-// PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
-//
-//*********************************************************
-//-----------------------------------------------------------------------------
-//
-// This code was generated by a tool.
-//
-// Changes to this file may cause incorrect behavior and will be lost if
-// the code is regenerated.
-//
-// For more information, see: http://go.microsoft.com/fwlink/?LinkID=623246
-//
-//-----------------------------------------------------------------------------
-#pragma once
-
-// The amount of time to wait (ms) for a response after sending a message before timing out.
-const int c_MessageTimeoutInMilliseconds = 10000;
-
-// The maximum length of an AllJoyn type signature allowed by the AllJoyn Core library.
-const int c_MaximumSignatureLength = 255;
-
-#define RETURN_IF_QSTATUS_ERROR(status) \
-{ \
-int32 alljoynStatus = static_cast(status); \
-if (Windows::Devices::AllJoyn::AllJoynStatus::Ok != alljoynStatus) \
-{ \
- return status; \
-} \
-}
-
-namespace com { namespace microsoft { namespace Samples { namespace SecureInterface {
-
-public interface class ISignalEmitter
-{
- property Windows::Devices::AllJoyn::AllJoynBusObject^ BusObject
- {
- Windows::Devices::AllJoyn::AllJoynBusObject^ get();
- }
-
- property Windows::Devices::AllJoyn::AllJoynSession^ Session
- {
- Windows::Devices::AllJoyn::AllJoynSession^ get();
- }
-};
-
-} } } }
-
-class AllJoynHelpers
-{
-public:
- // The Windows::Devices::AllJoyn::AllJoynBusAttachment class wraps the alljoyn_busattachment type. This
- // function gets the underlying alljoyn_busattachment.
- static alljoyn_busattachment GetInternalBusAttachment(_In_ Windows::Devices::AllJoyn::AllJoynBusAttachment^ busAttachment);
-
- // The Windows::Devices::AllJoyn::AllJoynBusObject class wraps the alljoyn_busobject type. This
- // function gets the underlying alljoyn_busobject.
- static alljoyn_busobject AllJoynHelpers::GetInternalBusObject(_In_ Windows::Devices::AllJoyn::AllJoynBusObject^ busObject);
-
- // Create the alljoyn_interfacedescriptions described in introspectionXml and add them to the busAttachment.
- static QStatus CreateInterfaces(_Inout_ Windows::Devices::AllJoyn::AllJoynBusAttachment^ busAttachment, _In_ PCSTR introspectionXml);
-
- // Convert a UTF8 string to a wide character Platform::String.
- static Platform::String^ MultibyteToPlatformString(_In_ PCSTR);
-
- // Convert a wide character Platform::String to a UTF8 string.
- static std::vector PlatformToMultibyteString(_In_ Platform::String^ str);
-
- // Get the service object path from an objectDescriptionArg. The objectDescriptionArg should
- // come from an Announce signal.
- static Platform::String^ GetObjectPath(_In_ alljoyn_aboutobjectdescription objectDescription, _In_ PCSTR interfaceName);
-
- // Determine whether the supplied set of AuthenticationMechanisms is sufficient for securing an AllJoyn connection.
- static bool CanSecure(_In_ Windows::Foundation::Collections::IVector^ authenticationMechanisms);
-
- // Callback for alljoyn_proxybusobject_listener_propertieschanged_ptr.
- // This callback expects the context to be of type T, which must implement the OnPropertyChanged function.
- template
- static void AJ_CALL PropertyChangedHandler(_In_ alljoyn_proxybusobject obj, _In_ PCSTR interfaceName, _In_ const alljoyn_msgarg changed, _In_ const alljoyn_msgarg invalidated, _In_ void* context)
- {
- T^ caller = static_cast(context)->Resolve();
- caller->OnPropertyChanged(obj, interfaceName, changed, invalidated);
- }
-
- // Callback for alljoyn_busobject_prop_get_ptr.
- template
- static QStatus AJ_CALL PropertyGetHandler(_In_ const void* context, _In_ PCSTR interfaceName, _In_ PCSTR propertyName, _In_ alljoyn_msgarg value)
- {
- T^ caller = static_cast(context)->Resolve();
- return caller->OnPropertyGet(interfaceName, propertyName, value);
- }
-
- // Callback for alljoyn_busobject_prop_set_ptr.
- template
- static QStatus AJ_CALL PropertySetHandler(_In_ const void* context, _In_ PCSTR interfaceName, _In_ PCSTR propertyName, _In_ alljoyn_msgarg value)
- {
- T^ caller = static_cast(context)->Resolve();
- return caller->OnPropertySet(interfaceName, propertyName, value);
- }
-
- // Callback for alljoyn_sessionlistener_sessionlost_ptr.
- template
- static void AJ_CALL SessionLostHandler(_In_ const void* context, _In_ alljoyn_sessionid sessionId, _In_ alljoyn_sessionlostreason reason)
- {
- T^ caller = static_cast(context)->Resolve();
- caller->OnSessionLost(sessionId, reason);
- }
-
- // Callback for alljoyn_sessionlistener_sessionmemberadded_ptr.
- template
- static void AJ_CALL SessionMemberAddedHandler(_In_ const void* context, _In_ alljoyn_sessionid sessionId, _In_ PCSTR uniqueName)
- {
- T^ caller = static_cast(context)->Resolve();
- caller->OnSessionMemberAdded(sessionId, uniqueName);
- }
-
- // Callback for alljoyn_sessionlistener_sessionmemberremoved_ptr.
- template
- static void AJ_CALL SessionMemberRemovedHandler(_In_ const void* context, _In_ alljoyn_sessionid sessionId, _In_ PCSTR uniqueName)
- {
- T^ caller = static_cast(context)->Resolve();
- caller->OnSessionMemberRemoved(sessionId, uniqueName);
- }
-
- // Create an AllJoyn bus object.
- template
- static QStatus CreateBusObject(_Inout_ Platform::WeakReference* target)
- {
- alljoyn_busobject_callbacks callbacks =
- {
- PropertyGetHandler,
- PropertySetHandler,
- nullptr,
- nullptr,
- };
-
- T^ caller = target->Resolve();
-
- auto serviceObjectPath = PlatformToMultibyteString(caller->ServiceObjectPath);
- alljoyn_busobject busObject = alljoyn_busobject_create(serviceObjectPath.data(), false, &callbacks, target);
- if (busObject == nullptr)
- {
- return ER_FAIL;
- }
-
- caller->BusObject = busObject;
-
- return ER_OK;
- }
-
- // Callback for alljoyn_sessionportlistener_acceptsessionjoiner_ptr.
- // This callback expects the context to be of type T, which must implement the OnAcceptSessionJoiner function.
- template
- static QCC_BOOL AJ_CALL AcceptSessionJoinerHandler(
- _In_ const void* context,
- _In_ alljoyn_sessionport sessionPort,
- _In_ PCSTR joiner,
- _In_ const alljoyn_sessionopts opts)
- {
- T^ caller = static_cast(context)->Resolve();
- return caller->OnAcceptSessionJoiner(sessionPort, joiner, opts);
- }
-
- // Callback for alljoyn_sessionportlistener_sessionjoined_ptr.
- // This callback expects the context to be of type T, which must implement the OnSessionJoined function.
- template
- static void AJ_CALL SessionJoinedHandler(
- _In_ const void* context,
- _In_ alljoyn_sessionport sessionPort,
- _In_ alljoyn_sessionid id,
- _In_ PCSTR joiner)
- {
- T^ caller = static_cast(context)->Resolve();
- caller->OnSessionJoined(sessionPort, id, joiner);
- }
-
- // Create the session for an AllJoyn producer.
- template
- static QStatus CreateProducerSession(_Inout_ Windows::Devices::AllJoyn::AllJoynBusAttachment^ busAttachment, _Inout_ Platform::WeakReference* target)
- {
- alljoyn_sessionopts opts = alljoyn_sessionopts_create(ALLJOYN_TRAFFIC_TYPE_MESSAGES, true, ALLJOYN_PROXIMITY_ANY, ALLJOYN_TRANSPORT_ANY);
-
- alljoyn_sessionportlistener_callbacks callbacks =
- {
- AcceptSessionJoinerHandler,
- SessionJoinedHandler
- };
-
- T^ producer = target->Resolve();
- producer->SessionPortListener = alljoyn_sessionportlistener_create(&callbacks, target);
-
- alljoyn_sessionport sessionPort = 42;
- alljoyn_busattachment_unbindsessionport(AllJoynHelpers::GetInternalBusAttachment(busAttachment), sessionPort);
- RETURN_IF_QSTATUS_ERROR(alljoyn_busattachment_bindsessionport(AllJoynHelpers::GetInternalBusAttachment(busAttachment), &sessionPort, opts, producer->SessionPortListener));
- producer->SessionPort = sessionPort;
-
- alljoyn_sessionopts_destroy(opts);
-
- return ER_OK;
- }
-};
-
-// Passed to property get callbacks to allow them to report when the async operation is completed.
-template
-class PropertyGetContext
-{
-public:
- void SetEvent()
- {
- m_event.set();
- }
-
- void Wait()
- {
- m_event.wait();
- }
-
- QStatus GetStatus()
- {
- return m_status;
- }
-
- void SetStatus(QStatus value)
- {
- m_status = value;
- }
-
- T GetValue()
- {
- return m_value;
- }
-
- void SetValue(T value)
- {
- m_value = value;
- }
-
-private:
- Concurrency::event m_event;
- QStatus m_status;
- T m_value;
-};
-
-// Passed to property set callbacks to allow them to report when the async operation is completed.
-class PropertySetContext
-{
-public:
- void SetEvent()
- {
- m_event.set();
- }
-
- void Wait()
- {
- m_event.wait();
- }
-
- QStatus GetStatus()
- {
- return m_status;
- }
-
- void SetStatus(QStatus value)
- {
- m_status = value;
- }
-
-private:
- Concurrency::event m_event;
- QStatus m_status;
-};
diff --git a/Samples/AllJoyn/Common/Scenario1WinRTComponent/ISecureInterfaceService.h b/Samples/AllJoyn/Common/Scenario1WinRTComponent/ISecureInterfaceService.h
deleted file mode 100644
index 14b2c214bb..0000000000
--- a/Samples/AllJoyn/Common/Scenario1WinRTComponent/ISecureInterfaceService.h
+++ /dev/null
@@ -1,46 +0,0 @@
-//*********************************************************
-//
-// Copyright (c) Microsoft. All rights reserved.
-// This code is licensed under the MIT License (MIT).
-// THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
-// ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
-// IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
-// PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
-//
-//*********************************************************
-//-----------------------------------------------------------------------------
-//
-// This code was generated by a tool.
-//
-// Changes to this file may cause incorrect behavior and will be lost if
-// the code is regenerated.
-//
-// For more information, see: http://go.microsoft.com/fwlink/?LinkID=623246
-//
-//-----------------------------------------------------------------------------
-#pragma once
-
-namespace com { namespace microsoft { namespace Samples { namespace SecureInterface {
-
-public interface class ISecureInterfaceService
-{
-public:
- // "Concatenate two input strings and returns the concatenated string as output"
- // Implement this function to handle calls to the Concatenate method.
- Windows::Foundation::IAsyncOperation^ ConcatenateAsync(_In_ Windows::Devices::AllJoyn::AllJoynMessageInfo^ info , _In_ Platform::String^ interfaceMemberInStr1, _In_ Platform::String^ interfaceMemberInStr2);
-
- // "Determine if the output of the Concatenate method is returned as upper case string or not"
- // Implement this function to handle requests for the value of the IsUpperCaseEnabled property.
- //
- // Currently, info will always be null, because no information is available about the requestor.
- Windows::Foundation::IAsyncOperation^ GetIsUpperCaseEnabledAsync(Windows::Devices::AllJoyn::AllJoynMessageInfo^ info);
-
- // "Determine if the output of the Concatenate method is returned as upper case string or not"
- // Implement this function to handle requests to set the IsUpperCaseEnabled property.
- //
- // Currently, info will always be null, because no information is available about the requestor.
- Windows::Foundation::IAsyncOperation^ SetIsUpperCaseEnabledAsync(Windows::Devices::AllJoyn::AllJoynMessageInfo^ info, bool value);
-
-};
-
-} } } }
diff --git a/Samples/AllJoyn/Common/Scenario1WinRTComponent/Scenario1IntrospectionXml.xml b/Samples/AllJoyn/Common/Scenario1WinRTComponent/Scenario1IntrospectionXml.xml
deleted file mode 100644
index 366ad9383e..0000000000
--- a/Samples/AllJoyn/Common/Scenario1WinRTComponent/Scenario1IntrospectionXml.xml
+++ /dev/null
@@ -1,20 +0,0 @@
-
-
- A secure AllJoyn sample
-
-
- Concatenate two input strings and returns the concatenated string as output
-
-
-
-
-
- Determine if the output of the Concatenate method is returned as upper case string or not
-
-
-
- This signal is emitted when producer sends a text message to consumer
-
-
-
-
diff --git a/Samples/AllJoyn/Common/Scenario1WinRTComponent/Scenario1WinRTComponent.vcxproj b/Samples/AllJoyn/Common/Scenario1WinRTComponent/Scenario1WinRTComponent.vcxproj
deleted file mode 100644
index be19353746..0000000000
--- a/Samples/AllJoyn/Common/Scenario1WinRTComponent/Scenario1WinRTComponent.vcxproj
+++ /dev/null
@@ -1,262 +0,0 @@
-
-
-
-
- Debug
- ARM
-
-
- Debug
- Win32
-
-
- Debug
- x64
-
-
- Release
- ARM
-
-
- Release
- Win32
-
-
- Release
- x64
-
-
-
- $([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), LICENSE))\SharedContent
-
-
- {cd05b6af-4bcf-55b1-b08c-45a3343a3664}
- WindowsRuntimeComponent
- Scenario1WinRTComponent
- com.microsoft.Samples.SecureInterface
- en-US
- 14.0
- true
- Windows Store
- 10.0.22621.0
- 10.0.22621.0
- 10.0
- true
-
-
-
- DynamicLibrary
- true
-
-
- DynamicLibrary
- true
-
-
- DynamicLibrary
- true
-
-
- DynamicLibrary
- false
- true
- true
-
-
- DynamicLibrary
- false
- true
- true
-
-
- DynamicLibrary
- false
- true
- true
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- false
-
-
- false
-
-
- false
-
-
- false
-
-
- false
-
-
- false
-
-
- $(VC_IncludePath);$(UniversalCRT_IncludePath);$(WindowsSDK_IncludePath);..\..\shared
-
-
-
- Use
- _WINRT_DLL;QCC_OS_GROUP_WINDOWS;%(PreprocessorDefinitions)
- pch.h
- $(IntDir)pch.pch
- $(WindowsSDK_WindowsMetadata);$(AdditionalUsingDirectories)
- /bigobj /Zm250
- 28204
-
-
- Console
- false
- WindowsApp.lib;msajapi.lib;%(AdditionalDependencies)
-
-
-
-
- Use
- _WINRT_DLL;QCC_OS_GROUP_WINDOWS;%(PreprocessorDefinitions)
- pch.h
- $(IntDir)pch.pch
- $(WindowsSDK_WindowsMetadata);$(AdditionalUsingDirectories)
- /bigobj /Zm250
- 28204
-
-
- Console
- false
- WindowsApp.lib;msajapi.lib;%(AdditionalDependencies)
-
-
-
-
- Use
- _WINRT_DLL;QCC_OS_GROUP_WINDOWS;%(PreprocessorDefinitions)
- pch.h
- $(IntDir)pch.pch
- $(WindowsSDK_WindowsMetadata);$(AdditionalUsingDirectories)
- /bigobj /Zm250
- 28204
-
-
- Console
- false
- WindowsApp.lib;msajapi.lib;%(AdditionalDependencies)
-
-
-
-
- Use
- _WINRT_DLL;QCC_OS_GROUP_WINDOWS;%(PreprocessorDefinitions)
- pch.h
- $(IntDir)pch.pch
- $(WindowsSDK_WindowsMetadata);$(AdditionalUsingDirectories)
- /bigobj /Zm250
- 28204
-
-
- Console
- false
- WindowsApp.lib;msajapi.lib;%(AdditionalDependencies)
-
-
-
-
- Use
- _WINRT_DLL;QCC_OS_GROUP_WINDOWS;%(PreprocessorDefinitions)
- pch.h
- $(IntDir)pch.pch
- $(WindowsSDK_WindowsMetadata);$(AdditionalUsingDirectories)
- /bigobj /Zm250
- 28204
-
-
- Console
- false
- WindowsApp.lib;msajapi.lib;%(AdditionalDependencies)
-
-
-
-
- Use
- _WINRT_DLL;QCC_OS_GROUP_WINDOWS;%(PreprocessorDefinitions)
- pch.h
- $(IntDir)pch.pch
- $(WindowsSDK_WindowsMetadata);$(AdditionalUsingDirectories)
- /bigobj /Zm250
- 28204
-
-
- Console
- false
- WindowsApp.lib;msajapi.lib;%(AdditionalDependencies)
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Create
- Create
- Create
- Create
- Create
- Create
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/Samples/AllJoyn/Common/Scenario1WinRTComponent/Scenario1WinRTComponent.vcxproj.filters b/Samples/AllJoyn/Common/Scenario1WinRTComponent/Scenario1WinRTComponent.vcxproj.filters
deleted file mode 100644
index c0e053639e..0000000000
--- a/Samples/AllJoyn/Common/Scenario1WinRTComponent/Scenario1WinRTComponent.vcxproj.filters
+++ /dev/null
@@ -1,37 +0,0 @@
-
-
-
-
- aa05969e-0ba6-407c-9c26-91ed00b63b8b
- rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tga;tiff;tif;png;wav;mfcribbon-ms
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/Samples/AllJoyn/Common/Scenario1WinRTComponent/SecureInterfaceConsumer.cpp b/Samples/AllJoyn/Common/Scenario1WinRTComponent/SecureInterfaceConsumer.cpp
deleted file mode 100644
index f65069e25c..0000000000
--- a/Samples/AllJoyn/Common/Scenario1WinRTComponent/SecureInterfaceConsumer.cpp
+++ /dev/null
@@ -1,429 +0,0 @@
-//*********************************************************
-//
-// Copyright (c) Microsoft. All rights reserved.
-// This code is licensed under the MIT License (MIT).
-// THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
-// ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
-// IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
-// PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
-//
-//*********************************************************
-//-----------------------------------------------------------------------------
-//
-// This code was generated by a tool.
-//
-// Changes to this file may cause incorrect behavior and will be lost if
-// the code is regenerated.
-//
-// For more information, see: http://go.microsoft.com/fwlink/?LinkID=623246
-//
-//-----------------------------------------------------------------------------
-#include "pch.h"
-
-using namespace concurrency;
-using namespace Microsoft::WRL;
-using namespace Platform;
-using namespace Windows::Foundation;
-using namespace Windows::Devices::AllJoyn;
-using namespace com::microsoft::Samples::SecureInterface;
-
-std::map SecureInterfaceConsumer::SourceInterfaces;
-PCSTR SecureInterfaceConsumer::m_interfaceName = "com.microsoft.Samples.SecureInterface";
-
-SecureInterfaceConsumer::SecureInterfaceConsumer(AllJoynBusAttachment^ busAttachment)
- : m_busAttachment(busAttachment),
- m_proxyBusObject(nullptr),
- m_busObject(nullptr)
-{
- m_weak = new WeakReference(this);
- m_signals = ref new SecureInterfaceSignals();
- m_nativeBusAttachment = AllJoynHelpers::GetInternalBusAttachment(m_busAttachment);
-
- GUID result;
- HRESULT hr = CoCreateGuid(&result);
-
- if (FAILED(hr))
- {
- throw ref new Exception(hr);
- }
-
- // The consumer needs a bus object to share signals, and its object path must be unique in
- // case multiple consumers are created using the same bus attachment.
- Guid gd(result);
- ServiceObjectPath = gd.ToString();
-}
-
-SecureInterfaceConsumer::~SecureInterfaceConsumer()
-{
- if (nullptr != ProxyBusObject)
- {
- alljoyn_proxybusobject_destroy(ProxyBusObject);
- }
- delete m_weak;
-}
-
-QStatus SecureInterfaceConsumer::AddSignalHandler(_In_ alljoyn_busattachment busAttachment, _In_ alljoyn_interfacedescription interfaceDescription, _In_ PCSTR methodName, _In_ alljoyn_messagereceiver_signalhandler_ptr handler)
-{
- alljoyn_interfacedescription_member member;
- if (!alljoyn_interfacedescription_getmember(interfaceDescription, methodName, &member))
- {
- return ER_BUS_INTERFACE_NO_SUCH_MEMBER;
- }
-
- return alljoyn_busattachment_registersignalhandler(busAttachment, handler, member, NULL);
-}
-
-IAsyncOperation^ SecureInterfaceConsumer::FromIdAsync(_In_ Platform::String^ deviceId)
-{
- return SecureInterfaceConsumer::FromIdAsync(deviceId, AllJoynBusAttachment::GetDefault());
-}
-
-IAsyncOperation^ SecureInterfaceConsumer::FromIdAsync(_In_ Platform::String^ deviceId, _In_ AllJoynBusAttachment^ busAttachment)
-{
- return create_async([deviceId, busAttachment]() -> SecureInterfaceConsumer^
- {
- SecureInterfaceConsumer^ result;
- create_task(AllJoynServiceInfo::FromIdAsync(deviceId)).then([busAttachment, &result](AllJoynServiceInfo^ serviceInfo)
- {
- if (serviceInfo != nullptr)
- {
- int32 status = AllJoynStatus::Ok;
- if (busAttachment->State == AllJoynBusAttachmentState::Disconnected)
- {
- event connectedEvent;
- auto token = busAttachment->StateChanged += ref new TypedEventHandler([&connectedEvent](AllJoynBusAttachment^, AllJoynBusAttachmentStateChangedEventArgs^ arg)
- {
- if (arg->State == AllJoynBusAttachmentState::Connected)
- {
- connectedEvent.set();
- }
- });
-
- status = AllJoynHelpers::CreateInterfaces(busAttachment, c_SecureInterfaceIntrospectionXml);
- if (status == AllJoynStatus::Ok)
- {
- busAttachment->Connect();
- connectedEvent.wait();
- }
- busAttachment->StateChanged -= token;
- }
-
- if (status == AllJoynStatus::Ok)
- {
- auto consumer = ref new SecureInterfaceConsumer(busAttachment);
- status = consumer->Initialize(serviceInfo);
- if (status == AllJoynStatus::Ok)
- {
- result = consumer;
- }
- }
- }
- }).wait();
-
- return result;
- });
-}
-
-IAsyncOperation^ SecureInterfaceConsumer::ConcatenateAsync(_In_ Platform::String^ interfaceMemberInStr1, _In_ Platform::String^ interfaceMemberInStr2)
-{
- return create_async([this, interfaceMemberInStr1, interfaceMemberInStr2]() -> SecureInterfaceConcatenateResult^
- {
- auto result = ref new SecureInterfaceConcatenateResult();
-
- alljoyn_message message = alljoyn_message_create(m_nativeBusAttachment);
- size_t argCount = 2;
- alljoyn_msgarg inputs = alljoyn_msgarg_array_create(argCount);
-
- QStatus status = ER_OK;
- status = static_cast(TypeConversionHelpers::SetAllJoynMessageArg(alljoyn_msgarg_array_element(inputs, 0), "s", interfaceMemberInStr1));
- if (ER_OK == status)
- {
- status = static_cast(TypeConversionHelpers::SetAllJoynMessageArg(alljoyn_msgarg_array_element(inputs, 1), "s", interfaceMemberInStr2));
- }
- if (ER_OK == status)
- {
- status = alljoyn_proxybusobject_methodcall(
- ProxyBusObject,
- m_interfaceName,
- "Concatenate",
- inputs,
- argCount,
- message,
- c_MessageTimeoutInMilliseconds,
- 0);
- }
- result->Status = static_cast(status);
- if (ER_OK == status)
- {
- result->Status = AllJoynStatus::Ok;
- Platform::String^ argument0;
- status = static_cast(TypeConversionHelpers::GetAllJoynMessageArg(alljoyn_message_getarg(message, 0), "s", &argument0));
- result->OutStr = argument0;
-
- if (ER_OK != status)
- {
- result->Status = static_cast(status);
- }
- }
- else if (ER_BUS_REPLY_IS_ERROR_MESSAGE == status)
- {
- alljoyn_msgarg errorArg = alljoyn_message_getarg(message, 1);
- if (nullptr != errorArg)
- {
- uint16 errorStatus;
- status = alljoyn_msgarg_get_uint16(errorArg, &errorStatus);
- if (ER_OK == status)
- {
- status = static_cast(errorStatus);
- }
- }
- result->Status = static_cast(status);
- }
-
- alljoyn_message_destroy(message);
- alljoyn_msgarg_destroy(inputs);
-
- return result;
- });
-}
-
-IAsyncOperation^ SecureInterfaceConsumer::SetIsUpperCaseEnabledAsync(_In_ bool value)
-{
- return create_async([this, value]() -> SecureInterfaceSetIsUpperCaseEnabledResult^
- {
- PropertySetContext setContext;
-
- alljoyn_msgarg inputArgument = alljoyn_msgarg_create();
- QStatus status = static_cast(TypeConversionHelpers::SetAllJoynMessageArg(inputArgument, "b", value));
- if (ER_OK == status)
- {
- status = alljoyn_proxybusobject_setpropertyasync(
- ProxyBusObject,
- m_interfaceName,
- "IsUpperCaseEnabled",
- inputArgument,
- [](QStatus status, alljoyn_proxybusobject obj, void* context)
- {
- UNREFERENCED_PARAMETER(obj);
- auto propertyContext = static_cast(context);
- propertyContext->SetStatus(status);
- propertyContext->SetEvent();
- },
- c_MessageTimeoutInMilliseconds,
- &setContext);
-
- alljoyn_msgarg_destroy(inputArgument);
-
- setContext.Wait();
- }
- if (ER_OK == status)
- {
- return SecureInterfaceSetIsUpperCaseEnabledResult::CreateSuccessResult();
- }
- return SecureInterfaceSetIsUpperCaseEnabledResult::CreateFailureResult(static_cast(status));
- });
-}
-
-IAsyncOperation^ SecureInterfaceConsumer::GetIsUpperCaseEnabledAsync()
-{
- return create_async([this]() -> SecureInterfaceGetIsUpperCaseEnabledResult^
- {
- PropertyGetContext getContext;
-
- alljoyn_proxybusobject_getpropertyasync(
- ProxyBusObject,
- m_interfaceName,
- "IsUpperCaseEnabled",
- [](QStatus status, alljoyn_proxybusobject obj, const alljoyn_msgarg value, void* context)
- {
- UNREFERENCED_PARAMETER(obj);
- auto propertyContext = static_cast*>(context);
-
- if (ER_OK == status)
- {
- bool argument;
- status = static_cast(TypeConversionHelpers::GetAllJoynMessageArg(value, "b", &argument));
-
- propertyContext->SetValue(argument);
- }
- propertyContext->SetStatus(status);
- propertyContext->SetEvent();
- },
- c_MessageTimeoutInMilliseconds,
- &getContext);
-
- getContext.Wait();
-
- auto result = ref new SecureInterfaceGetIsUpperCaseEnabledResult();
- result->Status = getContext.GetStatus();
- result->IsUpperCaseEnabled = getContext.GetValue();
- return result;
- });
-}
-
-void SecureInterfaceConsumer::OnPropertyChanged(_In_ alljoyn_proxybusobject obj, _In_ PCSTR interfaceName, _In_ const alljoyn_msgarg changed, _In_ const alljoyn_msgarg invalidated)
-{
- UNREFERENCED_PARAMETER(obj);
- UNREFERENCED_PARAMETER(interfaceName);
- UNREFERENCED_PARAMETER(invalidated);
-
- alljoyn_msgarg changedProperties;
- size_t changedPropertyCount;
- if (ER_OK != alljoyn_msgarg_get(changed, "a{sv}", &changedPropertyCount, &changedProperties))
- {
- return;
- }
-
- for (size_t i = 0; i < changedPropertyCount; i++)
- {
- char* propertyName;
- alljoyn_msgarg propertyValue;
- if (ER_OK != alljoyn_msgarg_get(alljoyn_msgarg_array_element(changedProperties, i), "{sv}", &propertyName, &propertyValue))
- {
- return;
- }
-
-
- if (strcmp("IsUpperCaseEnabled", propertyName) == 0)
- {
- bool argument;
- (void)TypeConversionHelpers::GetAllJoynMessageArg(propertyValue, "b", &argument);
- IsUpperCaseEnabledChanged(this, (Platform::Object^)argument);
- }
- }
-}
-
-void SecureInterfaceConsumer::CallTextSentSignalHandler(_In_ const alljoyn_interfacedescription_member* member, _In_ alljoyn_message message)
-{
- auto source = SourceInterfaces.find(member->iface);
- if (source == SourceInterfaces.end())
- {
- return;
- }
-
- auto consumer = source->second->Resolve();
- if (consumer->Signals != nullptr)
- {
- auto callInfo = ref new AllJoynMessageInfo(AllJoynHelpers::MultibyteToPlatformString(alljoyn_message_getsender(message)));
- auto eventArgs = ref new SecureInterfaceTextSentReceivedEventArgs();
- eventArgs->MessageInfo = callInfo;
-
- Platform::String^ argument0;
- (void)TypeConversionHelpers::GetAllJoynMessageArg(alljoyn_message_getarg(message, 0), "s", &argument0);
-
- eventArgs->Message = argument0;
-
- consumer->Signals->CallTextSentReceived(consumer->Signals, eventArgs);
- }
-}
-
-int32 SecureInterfaceConsumer::Initialize(_In_ AllJoynServiceInfo^ serviceInfo)
-{
- std::vector sessionNameUtf8 = AllJoynHelpers::PlatformToMultibyteString(serviceInfo->UniqueName);
-
- ServiceObjectPath = serviceInfo->ObjectPath;
- std::vector objectPath = AllJoynHelpers::PlatformToMultibyteString(ServiceObjectPath);
-
- RETURN_IF_QSTATUS_ERROR(AllJoynHelpers::CreateInterfaces(m_busAttachment, c_SecureInterfaceIntrospectionXml));
-
- m_session = create_task(AllJoynSession::GetFromServiceInfoAsync(serviceInfo, m_busAttachment)).get();
- if (nullptr == m_session)
- {
- return AllJoynStatus::Fail;
- }
- else if (m_session->Status != AllJoynStatus::Ok)
- {
- return m_session->Status;
- }
-
- if (objectPath.empty())
- {
- return AllJoynStatus::Fail;
- }
-
- ProxyBusObject = alljoyn_proxybusobject_create(m_nativeBusAttachment, &sessionNameUtf8[0], &objectPath[0], m_session->Id);
- if (nullptr == ProxyBusObject)
- {
- return AllJoynStatus::Fail;
- }
-
- PCSTR propertyNames[] = { "IsUpperCaseEnabled" };
-
- RETURN_IF_QSTATUS_ERROR(alljoyn_proxybusobject_registerpropertieschangedlistener(
- ProxyBusObject,
- m_interfaceName,
- propertyNames,
- _countof(propertyNames),
- AllJoynHelpers::PropertyChangedHandler,
- m_weak));
-
-
- alljoyn_interfacedescription description = alljoyn_busattachment_getinterface(m_nativeBusAttachment, m_interfaceName);
- if (nullptr == description)
- {
- return AllJoynStatus::Fail;
- }
-
- m_busObject = ref new Windows::Devices::AllJoyn::AllJoynBusObject(ServiceObjectPath, m_busAttachment);
- m_nativeBusObject = AllJoynHelpers::GetInternalBusObject(m_busObject);
-
- QStatus status = alljoyn_busobject_addinterface(m_nativeBusObject, description);
- if ((status != ER_OK) && (status != ER_BUS_IFACE_ALREADY_EXISTS))
- {
- return status;
- }
-
-
- QStatus result = AddSignalHandler(
- m_nativeBusAttachment,
- description,
- "TextSent",
- [](const alljoyn_interfacedescription_member* member, PCSTR srcPath, alljoyn_message message) { UNREFERENCED_PARAMETER(srcPath); CallTextSentSignalHandler(member, message); });
-
- if (ER_OK != result)
- {
- return static_cast(result);
- }
-
- SourceInterfaces[description] = m_weak;
-
- unsigned int noneMechanismIndex = 0;
- bool authenticationMechanismsContainsNone = m_busAttachment->AuthenticationMechanisms->IndexOf(AllJoynAuthenticationMechanism::None, &noneMechanismIndex);
- QCC_BOOL interfaceIsSecure = alljoyn_interfacedescription_issecure(description);
-
- // If the current set of AuthenticationMechanisms supports authentication,
- // determine whether to secure the connection.
- if (AllJoynHelpers::CanSecure(m_busAttachment->AuthenticationMechanisms))
- {
- // Secure the connection if the org.alljoyn.Bus.Secure XML annotation
- // is specified, or if None is not present in AuthenticationMechanisms.
- if (!authenticationMechanismsContainsNone || interfaceIsSecure)
- {
- RETURN_IF_QSTATUS_ERROR(alljoyn_proxybusobject_secureconnection(ProxyBusObject, QCC_FALSE));
- m_busObject->Start();
- }
- else
- {
- m_busObject->Start();
- }
- }
- else
- {
- // If the current set of AuthenticationMechanisms does not support authentication
- // but the interface requires security, report an error.
- if (interfaceIsSecure)
- {
- return static_cast(ER_BUS_NO_AUTHENTICATION_MECHANISM);
- }
- else
- {
- m_busObject->Start();
- }
- }
-
- RETURN_IF_QSTATUS_ERROR(alljoyn_proxybusobject_addinterface(ProxyBusObject, description));
-
- m_signals->Initialize(this);
-
- return AllJoynStatus::Ok;
-}
diff --git a/Samples/AllJoyn/Common/Scenario1WinRTComponent/SecureInterfaceConsumer.h b/Samples/AllJoyn/Common/Scenario1WinRTComponent/SecureInterfaceConsumer.h
deleted file mode 100644
index 50cb866700..0000000000
--- a/Samples/AllJoyn/Common/Scenario1WinRTComponent/SecureInterfaceConsumer.h
+++ /dev/null
@@ -1,170 +0,0 @@
-//*********************************************************
-//
-// Copyright (c) Microsoft. All rights reserved.
-// This code is licensed under the MIT License (MIT).
-// THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
-// ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
-// IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
-// PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
-//
-//*********************************************************
-//-----------------------------------------------------------------------------
-//
-// This code was generated by a tool.
-//
-// Changes to this file may cause incorrect behavior and will be lost if
-// the code is regenerated.
-//
-// For more information, see: http://go.microsoft.com/fwlink/?LinkID=623246
-//
-//-----------------------------------------------------------------------------
-#pragma once
-
-namespace com { namespace microsoft { namespace Samples { namespace SecureInterface {
-
-public interface class ISecureInterfaceConsumer
-{
- event Windows::Foundation::TypedEventHandler^ IsUpperCaseEnabledChanged;
-};
-
-public ref class SecureInterfaceConsumer sealed : [Windows::Foundation::Metadata::Default] ISecureInterfaceConsumer, ISignalEmitter
-{
-public:
- SecureInterfaceConsumer(Windows::Devices::AllJoyn::AllJoynBusAttachment^ busAttachment);
- virtual ~SecureInterfaceConsumer();
-
- // Create a consumer from a device Id asynchronously.
- //
- // This is usually called to create a consumer after the unique name of a producer has been reported
- // in the Added callback on the DeviceWatcher.
- static Windows::Foundation::IAsyncOperation^ FromIdAsync(_In_ Platform::String^ deviceId);
-
- // Create a consumer from a device Id asynchronously with the provided bus attachment.
- //
- // This is usually called to create a consumer after the unique name of a producer has been reported
- // in the Added callback on the DeviceWatcher.
- static Windows::Foundation::IAsyncOperation^ FromIdAsync(_In_ Platform::String^ deviceId, _In_ Windows::Devices::AllJoyn::AllJoynBusAttachment^ busAttachment);
-
- int32 SecureInterfaceConsumer::Initialize(_In_ Windows::Devices::AllJoyn::AllJoynServiceInfo^ serviceInfo);
-
- // "Concatenate two input strings and returns the concatenated string as output"
- // Call the Concatenate method
- Windows::Foundation::IAsyncOperation^ ConcatenateAsync(_In_ Platform::String^ interfaceMemberInStr1, _In_ Platform::String^ interfaceMemberInStr2);
-
- // This event fires whenever the value of IsUpperCaseEnabled changes.
- virtual event Windows::Foundation::TypedEventHandler^ IsUpperCaseEnabledChanged
- {
- Windows::Foundation::EventRegistrationToken add(Windows::Foundation::TypedEventHandler^ handler)
- {
- return _IsUpperCaseEnabledChanged += ref new Windows::Foundation::EventHandler
- ([handler](Platform::Object^ sender, Platform::Object^ args)
- {
- handler->Invoke(safe_cast(sender), safe_cast(args));
- }, Platform::CallbackContext::Same);
- }
- void remove(Windows::Foundation::EventRegistrationToken token)
- {
- _IsUpperCaseEnabledChanged -= token;
- }
- internal:
- void raise(SecureInterfaceConsumer^ sender, Platform::Object^ args)
- {
- _IsUpperCaseEnabledChanged(sender, args);
- }
- }
-
- // "Determine if the output of the Concatenate method is returned as upper case string or not"
- // Get the value of the IsUpperCaseEnabled property.
- Windows::Foundation::IAsyncOperation^ GetIsUpperCaseEnabledAsync();
-
- // "Determine if the output of the Concatenate method is returned as upper case string or not"
- // Set the value of the IsUpperCaseEnabled property.
- Windows::Foundation::IAsyncOperation^ SetIsUpperCaseEnabledAsync(_In_ bool value);
-
- // Used to send signals or register functions to handle received signals.
- property SecureInterfaceSignals^ Signals
- {
- SecureInterfaceSignals^ get() { return m_signals; }
- }
-
- // Used to get the name of the interface this consumer implements.
- static property Platform::String^ InterfaceName
- {
- Platform::String^ get() { return AllJoynHelpers::MultibyteToPlatformString(m_interfaceName); }
- }
-
- virtual property Windows::Devices::AllJoyn::AllJoynBusObject^ BusObject
- {
- Windows::Devices::AllJoyn::AllJoynBusObject^ get() { return m_busObject; }
- }
-
- virtual property Windows::Devices::AllJoyn::AllJoynSession^ Session
- {
- Windows::Devices::AllJoyn::AllJoynSession^ get() { return m_session; }
- }
-
-internal:
- // Consumers do not support property get.
- QStatus OnPropertyGet(_In_ PCSTR interfaceName, _In_ PCSTR propertyName, _Inout_ alljoyn_msgarg val)
- {
- UNREFERENCED_PARAMETER(interfaceName); UNREFERENCED_PARAMETER(propertyName); UNREFERENCED_PARAMETER(val);
- return ER_NOT_IMPLEMENTED;
- }
-
- // Consumers do not support property set.
- QStatus OnPropertySet(_In_ PCSTR interfaceName, _In_ PCSTR propertyName, _In_ alljoyn_msgarg val)
- {
- UNREFERENCED_PARAMETER(interfaceName); UNREFERENCED_PARAMETER(propertyName); UNREFERENCED_PARAMETER(val);
- return ER_NOT_IMPLEMENTED;
- }
-
- void OnPropertyChanged(_In_ alljoyn_proxybusobject obj, _In_ PCSTR interfaceName, _In_ const alljoyn_msgarg changed, _In_ const alljoyn_msgarg invalidated);
-
- property Platform::String^ ServiceObjectPath
- {
- Platform::String^ get() { return m_ServiceObjectPath; }
- void set(Platform::String^ value) { m_ServiceObjectPath = value; }
- }
-
- property alljoyn_proxybusobject ProxyBusObject
- {
- alljoyn_proxybusobject get() { return m_proxyBusObject; }
- void set(alljoyn_proxybusobject value) { m_proxyBusObject = value; }
- }
-
-private:
- virtual event Windows::Foundation::EventHandler^ _SessionLost;
- virtual event Windows::Foundation::EventHandler^ _SessionMemberAdded;
- virtual event Windows::Foundation::EventHandler^ _SessionMemberRemoved;
- virtual event Windows::Foundation::EventHandler^ _IsUpperCaseEnabledChanged;
-
- // Register a callback function to handle incoming signals.
- QStatus AddSignalHandler(_In_ alljoyn_busattachment busAttachment, _In_ alljoyn_interfacedescription interfaceDescription, _In_ PCSTR methodName, _In_ alljoyn_messagereceiver_signalhandler_ptr handler);
-
- // "This signal is emitted when producer sends a text message to consumer"
- static void CallTextSentSignalHandler(_In_ const alljoyn_interfacedescription_member* member, _In_ alljoyn_message message);
-
- Windows::Devices::AllJoyn::AllJoynBusAttachment^ m_busAttachment;
- Windows::Devices::AllJoyn::AllJoynBusObject^ m_busObject;
- Windows::Devices::AllJoyn::AllJoynSession^ m_session;
- SecureInterfaceSignals^ m_signals;
- Platform::String^ m_ServiceObjectPath;
-
- alljoyn_proxybusobject m_proxyBusObject;
- alljoyn_sessionlistener m_sessionListener;
- alljoyn_busobject m_nativeBusObject;
- alljoyn_busattachment m_nativeBusAttachment;
-
- // Used to pass a pointer to this class to callbacks
- Platform::WeakReference* m_weak;
-
- // This map is required because we need a way to pass the consumer to the signal
- // handlers, but the current AllJoyn C API does not allow passing a context to these
- // callbacks.
- static std::map SourceInterfaces;
-
- // The name of the interface this consumer implements.
- static PCSTR m_interfaceName;
-};
-
-} } } }
diff --git a/Samples/AllJoyn/Common/Scenario1WinRTComponent/SecureInterfaceEventArgs.h b/Samples/AllJoyn/Common/Scenario1WinRTComponent/SecureInterfaceEventArgs.h
deleted file mode 100644
index 5711a7a189..0000000000
--- a/Samples/AllJoyn/Common/Scenario1WinRTComponent/SecureInterfaceEventArgs.h
+++ /dev/null
@@ -1,50 +0,0 @@
-//*********************************************************
-//
-// Copyright (c) Microsoft. All rights reserved.
-// This code is licensed under the MIT License (MIT).
-// THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
-// ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
-// IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
-// PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
-//
-//*********************************************************
-//-----------------------------------------------------------------------------
-//
-// This code was generated by a tool.
-//
-// Changes to this file may cause incorrect behavior and will be lost if
-// the code is regenerated.
-//
-// For more information, see: http://go.microsoft.com/fwlink/?LinkID=623246
-//
-//-----------------------------------------------------------------------------
-#pragma once
-
-namespace com { namespace microsoft { namespace Samples { namespace SecureInterface {
-
-// Signals
-// "This signal is emitted when producer sends a text message to consumer"
-public ref class SecureInterfaceTextSentReceivedEventArgs sealed
-{
-public:
- property Windows::Devices::AllJoyn::AllJoynMessageInfo^ MessageInfo
- {
- Windows::Devices::AllJoyn::AllJoynMessageInfo^ get() { return m_messageInfo; }
- void set(_In_ Windows::Devices::AllJoyn::AllJoynMessageInfo^ value) { m_messageInfo = value; }
- }
-
- property Platform::String^ Message
- {
- Platform::String^ get() { return m_interfaceMemberMessage; }
- internal:
- void set(_In_ Platform::String^ value) { m_interfaceMemberMessage = value; }
- }
-
-private:
- Windows::Devices::AllJoyn::AllJoynMessageInfo^ m_messageInfo;
-
- Platform::String^ m_interfaceMemberMessage;
-};
-
-
-} } } }
diff --git a/Samples/AllJoyn/Common/Scenario1WinRTComponent/SecureInterfaceLegacySignals.cpp b/Samples/AllJoyn/Common/Scenario1WinRTComponent/SecureInterfaceLegacySignals.cpp
deleted file mode 100644
index 5d17129347..0000000000
--- a/Samples/AllJoyn/Common/Scenario1WinRTComponent/SecureInterfaceLegacySignals.cpp
+++ /dev/null
@@ -1,67 +0,0 @@
-//*********************************************************
-//
-// Copyright (c) Microsoft. All rights reserved.
-// This code is licensed under the MIT License (MIT).
-// THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
-// ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
-// IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
-// PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
-//
-//*********************************************************
-//-----------------------------------------------------------------------------
-//
-// This code was generated by a tool.
-//
-// Changes to this file may cause incorrect behavior and will be lost if
-// the code is regenerated.
-//
-// For more information, see: http://go.microsoft.com/fwlink/?LinkID=623246
-//
-//-----------------------------------------------------------------------------
-#include "pch.h"
-
-using namespace Microsoft::WRL;
-using namespace Platform;
-using namespace Windows::Devices::AllJoyn;
-using namespace Windows::Foundation;
-using namespace com::microsoft::Samples::SecureInterface;
-
-void SecureInterfaceLegacySignals::Initialize(_In_ alljoyn_busobject busObject, _In_ alljoyn_sessionid sessionId)
-{
- m_busObject = busObject;
- m_sessionId = sessionId;
-
- auto interfaceDefinition = alljoyn_busattachment_getinterface(alljoyn_busobject_getbusattachment(busObject), "com.microsoft.Samples.SecureInterface");
- alljoyn_interfacedescription_getmember(interfaceDefinition, "TextSent", &m_memberTextSent);
-}
-
-void SecureInterfaceLegacySignals::TextSent(_In_ Platform::String^ interfaceMemberMessage)
-{
- if (nullptr == m_busObject)
- {
- return;
- }
-
- size_t argCount = 1;
- alljoyn_msgarg arguments = alljoyn_msgarg_array_create(argCount);
- (void)TypeConversionHelpers::SetAllJoynMessageArg(alljoyn_msgarg_array_element(arguments, 0), "s", interfaceMemberMessage);
-
- alljoyn_busobject_signal(
- m_busObject,
- NULL, // Generated code only supports broadcast signals.
- m_sessionId,
- m_memberTextSent,
- arguments,
- argCount,
- 0, // A signal with a TTL of 0 will be sent to every member of the session, regardless of how long it takes to deliver the message
- ALLJOYN_MESSAGE_FLAG_GLOBAL_BROADCAST, // Broadcast to everyone in the session.
- NULL); // The generated code does not need the generated signal message
-
- alljoyn_msgarg_destroy(arguments);
-}
-
-void SecureInterfaceLegacySignals::CallTextSentReceived(_In_ SecureInterfaceLegacySignals^ sender, _In_ SecureInterfaceTextSentReceivedEventArgs^ args)
-{
- TextSentReceived(sender, args);
-}
-
diff --git a/Samples/AllJoyn/Common/Scenario1WinRTComponent/SecureInterfaceLegacySignals.h b/Samples/AllJoyn/Common/Scenario1WinRTComponent/SecureInterfaceLegacySignals.h
deleted file mode 100644
index 3a8f7aafcf..0000000000
--- a/Samples/AllJoyn/Common/Scenario1WinRTComponent/SecureInterfaceLegacySignals.h
+++ /dev/null
@@ -1,74 +0,0 @@
-//*********************************************************
-//
-// Copyright (c) Microsoft. All rights reserved.
-// This code is licensed under the MIT License (MIT).
-// THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
-// ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
-// IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
-// PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
-//
-//*********************************************************
-//-----------------------------------------------------------------------------
-//
-// This code was generated by a tool.
-//
-// Changes to this file may cause incorrect behavior and will be lost if
-// the code is regenerated.
-//
-// For more information, see: http://go.microsoft.com/fwlink/?LinkID=623246
-//
-//-----------------------------------------------------------------------------
-#pragma once
-
-namespace com { namespace microsoft { namespace Samples { namespace SecureInterface {
-
-ref class SecureInterfaceLegacySignals;
-
-public interface class ISecureInterfaceLegacySignals
-{
- event Windows::Foundation::TypedEventHandler^ TextSentReceived;
-};
-
-public ref class SecureInterfaceLegacySignals sealed : [Windows::Foundation::Metadata::Default] ISecureInterfaceLegacySignals
-{
-public:
- // "This signal is emitted when producer sends a text message to consumer"
- // Calling this method will send the TextSent signal to every member of the session.
- void TextSent(_In_ Platform::String^ interfaceMemberMessage);
-
- // This event fires whenever the TextSent signal is sent by another member of the session.
- virtual event Windows::Foundation::TypedEventHandler^ TextSentReceived
- {
- Windows::Foundation::EventRegistrationToken add(Windows::Foundation::TypedEventHandler^ handler)
- {
- return _TextSentReceived += ref new Windows::Foundation::EventHandler
- ([handler](Platform::Object^ sender, Platform::Object^ args)
- {
- handler->Invoke(safe_cast(sender), safe_cast(args));
- }, Platform::CallbackContext::Same);
- }
- void remove(Windows::Foundation::EventRegistrationToken token)
- {
- _TextSentReceived -= token;
- }
- internal:
- void raise(SecureInterfaceLegacySignals^ sender, SecureInterfaceTextSentReceivedEventArgs^ args)
- {
- _TextSentReceived(sender, args);
- }
- }
-
-internal:
- void Initialize(_In_ alljoyn_busobject busObject, _In_ alljoyn_sessionid sessionId);
- void CallTextSentReceived(_In_ SecureInterfaceLegacySignals^ sender, _In_ SecureInterfaceTextSentReceivedEventArgs^ args);
-
-private:
- alljoyn_busobject m_busObject;
- alljoyn_sessionid m_sessionId;
-
- virtual event Windows::Foundation::EventHandler^ _TextSentReceived;
-
- alljoyn_interfacedescription_member m_memberTextSent;
-};
-
-} } } }
\ No newline at end of file
diff --git a/Samples/AllJoyn/Common/Scenario1WinRTComponent/SecureInterfaceMethodResults.h b/Samples/AllJoyn/Common/Scenario1WinRTComponent/SecureInterfaceMethodResults.h
deleted file mode 100644
index 5634f79b49..0000000000
--- a/Samples/AllJoyn/Common/Scenario1WinRTComponent/SecureInterfaceMethodResults.h
+++ /dev/null
@@ -1,163 +0,0 @@
-//*********************************************************
-//
-// Copyright (c) Microsoft. All rights reserved.
-// This code is licensed under the MIT License (MIT).
-// THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
-// ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
-// IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
-// PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
-//
-//*********************************************************
-//-----------------------------------------------------------------------------
-//
-// This code was generated by a tool.
-//
-// Changes to this file may cause incorrect behavior and will be lost if
-// the code is regenerated.
-//
-// For more information, see: http://go.microsoft.com/fwlink/?LinkID=623246
-//
-//-----------------------------------------------------------------------------
-#pragma once
-
-using namespace concurrency;
-
-namespace com { namespace microsoft { namespace Samples { namespace SecureInterface {
-
-ref class SecureInterfaceConsumer;
-
-public ref class SecureInterfaceConcatenateResult sealed
-{
-public:
- property int32 Status
- {
- int32 get() { return m_status; }
- internal:
- void set(_In_ int32 value) { m_status = value; }
- }
-
- property Platform::String^ OutStr
- {
- Platform::String^ get() { return m_interfaceMemberOutStr; }
- internal:
- void set(_In_ Platform::String^ value) { m_interfaceMemberOutStr = value; }
- }
-
- static SecureInterfaceConcatenateResult^ CreateSuccessResult(_In_ Platform::String^ interfaceMemberOutStr)
- {
- auto result = ref new SecureInterfaceConcatenateResult();
- result->Status = Windows::Devices::AllJoyn::AllJoynStatus::Ok;
- result->OutStr = interfaceMemberOutStr;
- result->m_creationContext = Concurrency::task_continuation_context::use_current();
- return result;
- }
-
- static SecureInterfaceConcatenateResult^ CreateFailureResult(_In_ int32 status)
- {
- auto result = ref new SecureInterfaceConcatenateResult();
- result->Status = status;
- return result;
- }
-internal:
- Concurrency::task_continuation_context m_creationContext = Concurrency::task_continuation_context::use_default();
-
-private:
- int32 m_status;
- Platform::String^ m_interfaceMemberOutStr;
-};
-
-public ref class SecureInterfaceJoinSessionResult sealed
-{
-public:
- property int32 Status
- {
- int32 get() { return m_status; }
- internal:
- void set(_In_ int32 value) { m_status = value; }
- }
-
- property SecureInterfaceConsumer^ Consumer
- {
- SecureInterfaceConsumer^ get() { return m_consumer; }
- internal:
- void set(_In_ SecureInterfaceConsumer^ value) { m_consumer = value; }
- };
-
-private:
- int32 m_status;
- SecureInterfaceConsumer^ m_consumer;
-};
-
-public ref class SecureInterfaceGetIsUpperCaseEnabledResult sealed
-{
-public:
- property int32 Status
- {
- int32 get() { return m_status; }
- internal:
- void set(_In_ int32 value) { m_status = value; }
- }
-
- // "Determine if the output of the Concatenate method is returned as upper case string or not"
- property bool IsUpperCaseEnabled
- {
- bool get() { return m_value; }
- internal:
- void set(_In_ bool value) { m_value = value; }
- }
-
- static SecureInterfaceGetIsUpperCaseEnabledResult^ CreateSuccessResult(_In_ bool value)
- {
- auto result = ref new SecureInterfaceGetIsUpperCaseEnabledResult();
- result->Status = Windows::Devices::AllJoyn::AllJoynStatus::Ok;
- result->IsUpperCaseEnabled = value;
- result->m_creationContext = Concurrency::task_continuation_context::use_current();
- return result;
- }
-
- static SecureInterfaceGetIsUpperCaseEnabledResult^ CreateFailureResult(_In_ int32 status)
- {
- auto result = ref new SecureInterfaceGetIsUpperCaseEnabledResult();
- result->Status = status;
- return result;
- }
-internal:
- Concurrency::task_continuation_context m_creationContext = Concurrency::task_continuation_context::use_default();
-
-private:
- int32 m_status;
- bool m_value;
-};
-
-public ref class SecureInterfaceSetIsUpperCaseEnabledResult sealed
-{
-public:
- property int32 Status
- {
- int32 get() { return m_status; }
- internal:
- void set(_In_ int32 value) { m_status = value; }
- }
-
- static SecureInterfaceSetIsUpperCaseEnabledResult^ CreateSuccessResult()
- {
- auto result = ref new SecureInterfaceSetIsUpperCaseEnabledResult();
- result->Status = Windows::Devices::AllJoyn::AllJoynStatus::Ok;
- result->m_creationContext = Concurrency::task_continuation_context::use_current();
- return result;
- }
-
- static SecureInterfaceSetIsUpperCaseEnabledResult^ CreateFailureResult(_In_ int32 status)
- {
- auto result = ref new SecureInterfaceSetIsUpperCaseEnabledResult();
- result->Status = status;
- return result;
- }
-internal:
- Concurrency::task_continuation_context m_creationContext = Concurrency::task_continuation_context::use_default();
-
-private:
- int32 m_status;
-};
-
-} } } }
diff --git a/Samples/AllJoyn/Common/Scenario1WinRTComponent/SecureInterfaceProducer.cpp b/Samples/AllJoyn/Common/Scenario1WinRTComponent/SecureInterfaceProducer.cpp
deleted file mode 100644
index 2a6078ee6a..0000000000
--- a/Samples/AllJoyn/Common/Scenario1WinRTComponent/SecureInterfaceProducer.cpp
+++ /dev/null
@@ -1,447 +0,0 @@
-//*********************************************************
-//
-// Copyright (c) Microsoft. All rights reserved.
-// This code is licensed under the MIT License (MIT).
-// THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
-// ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
-// IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
-// PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
-//
-//*********************************************************
-//-----------------------------------------------------------------------------
-//
-// This code was generated by a tool.
-//
-// Changes to this file may cause incorrect behavior and will be lost if
-// the code is regenerated.
-//
-// For more information, see: http://go.microsoft.com/fwlink/?LinkID=623246
-//
-//-----------------------------------------------------------------------------
-#include "pch.h"
-
-using namespace concurrency;
-using namespace Microsoft::WRL;
-using namespace Platform;
-using namespace Windows::Foundation;
-using namespace Windows::Devices::AllJoyn;
-using namespace com::microsoft::Samples::SecureInterface;
-
-std::map SecureInterfaceProducer::SourceObjects;
-std::map SecureInterfaceProducer::SourceInterfaces;
-
-SecureInterfaceProducer::SecureInterfaceProducer(AllJoynBusAttachment^ busAttachment)
- : m_busAttachment(busAttachment),
- m_sessionListener(nullptr),
- m_busObject(nullptr),
- m_sessionPort(0),
- m_sessionId(0)
-{
- m_weak = new WeakReference(this);
- ServiceObjectPath = ref new String(L"/Service");
- m_signals = ref new SecureInterfaceLegacySignals();
- m_busAttachmentStateChangedToken.Value = 0;
-}
-
-SecureInterfaceProducer::~SecureInterfaceProducer()
-{
- UnregisterFromBus();
- delete m_weak;
-}
-
-void SecureInterfaceProducer::UnregisterFromBus()
-{
- if ((nullptr != m_busAttachment) && (0 != m_busAttachmentStateChangedToken.Value))
- {
- m_busAttachment->StateChanged -= m_busAttachmentStateChangedToken;
- m_busAttachmentStateChangedToken.Value = 0;
- }
- if ((nullptr != m_busAttachment) && (nullptr != SessionPortListener))
- {
- alljoyn_busattachment_unbindsessionport(AllJoynHelpers::GetInternalBusAttachment(m_busAttachment), m_sessionPort);
- alljoyn_sessionportlistener_destroy(SessionPortListener);
- SessionPortListener = nullptr;
- }
- if ((nullptr != m_busAttachment) && (nullptr != BusObject))
- {
- alljoyn_busattachment_unregisterbusobject(AllJoynHelpers::GetInternalBusAttachment(m_busAttachment), BusObject);
- alljoyn_busobject_destroy(BusObject);
- BusObject = nullptr;
- }
- if ((nullptr != m_busAttachment) && (nullptr != SessionListener))
- {
- alljoyn_busattachment_leavesession(AllJoynHelpers::GetInternalBusAttachment(m_busAttachment), m_sessionId);
- alljoyn_busattachment_setsessionlistener(AllJoynHelpers::GetInternalBusAttachment(m_busAttachment), m_sessionId, nullptr);
- alljoyn_sessionlistener_destroy(SessionListener);
- SessionListener = nullptr;
- }
-}
-
-bool SecureInterfaceProducer::OnAcceptSessionJoiner(_In_ alljoyn_sessionport sessionPort, _In_ PCSTR joiner, _In_ const alljoyn_sessionopts opts)
-{
- UNREFERENCED_PARAMETER(sessionPort); UNREFERENCED_PARAMETER(joiner); UNREFERENCED_PARAMETER(opts);
-
- return true;
-}
-
-void SecureInterfaceProducer::OnSessionJoined(_In_ alljoyn_sessionport sessionPort, _In_ alljoyn_sessionid id, _In_ PCSTR joiner)
-{
- UNREFERENCED_PARAMETER(joiner);
-
- // We initialize the Signals object after the session has been joined, because it needs
- // the session id.
- m_signals->Initialize(BusObject, id);
- m_sessionPort = sessionPort;
- m_sessionId = id;
-
- alljoyn_sessionlistener_callbacks callbacks =
- {
- AllJoynHelpers::SessionLostHandler,
- AllJoynHelpers::SessionMemberAddedHandler,
- AllJoynHelpers::SessionMemberRemovedHandler
- };
-
- SessionListener = alljoyn_sessionlistener_create(&callbacks, m_weak);
- alljoyn_busattachment_setsessionlistener(AllJoynHelpers::GetInternalBusAttachment(m_busAttachment), id, SessionListener);
-}
-
-void SecureInterfaceProducer::OnSessionLost(_In_ alljoyn_sessionid sessionId, _In_ alljoyn_sessionlostreason reason)
-{
- if (sessionId == m_sessionId)
- {
- AllJoynSessionLostEventArgs^ args = ref new AllJoynSessionLostEventArgs(static_cast(reason));
- SessionLost(this, args);
- }
-}
-
-void SecureInterfaceProducer::OnSessionMemberAdded(_In_ alljoyn_sessionid sessionId, _In_ PCSTR uniqueName)
-{
- if (sessionId == m_sessionId)
- {
- auto args = ref new AllJoynSessionMemberAddedEventArgs(AllJoynHelpers::MultibyteToPlatformString(uniqueName));
- SessionMemberAdded(this, args);
- }
-}
-
-void SecureInterfaceProducer::OnSessionMemberRemoved(_In_ alljoyn_sessionid sessionId, _In_ PCSTR uniqueName)
-{
- if (sessionId == m_sessionId)
- {
- auto args = ref new AllJoynSessionMemberRemovedEventArgs(AllJoynHelpers::MultibyteToPlatformString(uniqueName));
- SessionMemberRemoved(this, args);
- }
-}
-
-void SecureInterfaceProducer::BusAttachmentStateChanged(_In_ AllJoynBusAttachment^ sender, _In_ AllJoynBusAttachmentStateChangedEventArgs^ args)
-{
- if (args->State == AllJoynBusAttachmentState::Connected)
- {
- QStatus result = AllJoynHelpers::CreateProducerSession(m_busAttachment, m_weak);
- if (ER_OK != result)
- {
- StopInternal(result);
- return;
- }
- }
- else if (args->State == AllJoynBusAttachmentState::Disconnected)
- {
- StopInternal(ER_BUS_STOPPING);
- }
-}
-
-void SecureInterfaceProducer::CallConcatenateHandler(_Inout_ alljoyn_busobject busObject, _In_ alljoyn_message message)
-{
- auto source = SourceObjects.find(busObject);
- if (source == SourceObjects.end())
- {
- return;
- }
-
- SecureInterfaceProducer^ producer = source->second->Resolve();
- if (producer->Service != nullptr)
- {
- AllJoynMessageInfo^ callInfo = ref new AllJoynMessageInfo(AllJoynHelpers::MultibyteToPlatformString(alljoyn_message_getsender(message)));
-
- Platform::String^ inputArg0;
- (void)TypeConversionHelpers::GetAllJoynMessageArg(alljoyn_message_getarg(message, 0), "s", &inputArg0);
- Platform::String^ inputArg1;
- (void)TypeConversionHelpers::GetAllJoynMessageArg(alljoyn_message_getarg(message, 1), "s", &inputArg1);
-
- SecureInterfaceConcatenateResult^ result = create_task(producer->Service->ConcatenateAsync(callInfo, inputArg0, inputArg1)).get();
- create_task([](){}).then([=]
- {
- int32 status;
-
- if (nullptr == result)
- {
- alljoyn_busobject_methodreply_status(busObject, message, ER_BUS_NO_LISTENER);
- return;
- }
-
- status = result->Status;
- if (AllJoynStatus::Ok != status)
- {
- alljoyn_busobject_methodreply_status(busObject, message, static_cast(status));
- return;
- }
-
- size_t argCount = 1;
- alljoyn_msgarg outputs = alljoyn_msgarg_array_create(argCount);
-
- status = TypeConversionHelpers::SetAllJoynMessageArg(alljoyn_msgarg_array_element(outputs, 0), "s", result->OutStr);
- if (AllJoynStatus::Ok != status)
- {
- alljoyn_busobject_methodreply_status(busObject, message, static_cast(status));
- alljoyn_msgarg_destroy(outputs);
- return;
- }
-
- alljoyn_busobject_methodreply_args(busObject, message, outputs, argCount);
- alljoyn_msgarg_destroy(outputs);
- }, result->m_creationContext).wait();
- }
-}
-
-void SecureInterfaceProducer::CallTextSentSignalHandler(_In_ const alljoyn_interfacedescription_member* member, _In_ alljoyn_message message)
-{
- auto source = SourceInterfaces.find(member->iface);
- if (source == SourceInterfaces.end())
- {
- return;
- }
-
- auto producer = source->second->Resolve();
- if (producer->Signals != nullptr)
- {
- auto callInfo = ref new AllJoynMessageInfo(AllJoynHelpers::MultibyteToPlatformString(alljoyn_message_getsender(message)));
- auto eventArgs = ref new SecureInterfaceTextSentReceivedEventArgs();
- eventArgs->MessageInfo = callInfo;
-
- Platform::String^ argument0;
- (void)TypeConversionHelpers::GetAllJoynMessageArg(alljoyn_message_getarg(message, 0), "s", &argument0);
- eventArgs->Message = argument0;
-
- producer->Signals->CallTextSentReceived(producer->Signals, eventArgs);
- }
-}
-
-QStatus SecureInterfaceProducer::AddMethodHandler(_In_ alljoyn_interfacedescription interfaceDescription, _In_ PCSTR methodName, _In_ alljoyn_messagereceiver_methodhandler_ptr handler)
-{
- alljoyn_interfacedescription_member member;
- if (!alljoyn_interfacedescription_getmember(interfaceDescription, methodName, &member))
- {
- return ER_BUS_INTERFACE_NO_SUCH_MEMBER;
- }
-
- return alljoyn_busobject_addmethodhandler(
- m_busObject,
- member,
- handler,
- m_weak);
-}
-
-QStatus SecureInterfaceProducer::AddSignalHandler(_In_ alljoyn_busattachment busAttachment, _In_ alljoyn_interfacedescription interfaceDescription, _In_ PCSTR methodName, _In_ alljoyn_messagereceiver_signalhandler_ptr handler)
-{
- alljoyn_interfacedescription_member member;
- if (!alljoyn_interfacedescription_getmember(interfaceDescription, methodName, &member))
- {
- return ER_BUS_INTERFACE_NO_SUCH_MEMBER;
- }
-
- return alljoyn_busattachment_registersignalhandler(busAttachment, handler, member, NULL);
-}
-
-QStatus SecureInterfaceProducer::OnPropertyGet(_In_ PCSTR interfaceName, _In_ PCSTR propertyName, _Inout_ alljoyn_msgarg value)
-{
- UNREFERENCED_PARAMETER(interfaceName);
-
- if (0 == strcmp(propertyName, "IsUpperCaseEnabled"))
- {
- auto task = create_task(Service->GetIsUpperCaseEnabledAsync(nullptr));
- auto result = task.get();
-
- return create_task([](){}).then([=]() -> QStatus
- {
- if (AllJoynStatus::Ok != result->Status)
- {
- return static_cast(result->Status);
- }
- return static_cast(TypeConversionHelpers::SetAllJoynMessageArg(value, "b", result->IsUpperCaseEnabled));
- }, result->m_creationContext).get();
- }
-
- return ER_BUS_NO_SUCH_PROPERTY;
-}
-
-QStatus SecureInterfaceProducer::OnPropertySet(_In_ PCSTR interfaceName, _In_ PCSTR propertyName, _In_ alljoyn_msgarg value)
-{
- UNREFERENCED_PARAMETER(interfaceName);
-
- if (0 == strcmp(propertyName, "IsUpperCaseEnabled"))
- {
- bool argument;
- QStatus status = static_cast(TypeConversionHelpers::GetAllJoynMessageArg(value, "b", &argument));
- if (ER_OK == status)
- {
- auto task = create_task(Service->SetIsUpperCaseEnabledAsync(nullptr, argument));
- auto result = task.get();
- status = static_cast(result->Status);
- }
- return status;
- }
- return ER_BUS_NO_SUCH_PROPERTY;
-}
-
-void SecureInterfaceProducer::EmitIsUpperCaseEnabledChanged()
-{
- create_task([&]
- {
- alljoyn_msgarg value = alljoyn_msgarg_create();
- OnPropertyGet("com.microsoft.Samples.SecureInterface", "IsUpperCaseEnabled", value);
-
- alljoyn_busobject_emitpropertychanged(
- m_busObject,
- "com.microsoft.Samples.SecureInterface",
- "IsUpperCaseEnabled",
- value,
- m_sessionId);
-
- alljoyn_msgarg_destroy(value);
- });
-}
-
-void SecureInterfaceProducer::Start()
-{
- if (nullptr == m_busAttachment)
- {
- StopInternal(ER_FAIL);
- return;
- }
-
- QStatus result = AllJoynHelpers::CreateInterfaces(m_busAttachment, c_SecureInterfaceIntrospectionXml);
- if (result != ER_OK)
- {
- StopInternal(result);
- return;
- }
-
- result = AllJoynHelpers::CreateBusObject(m_weak);
- if (result != ER_OK)
- {
- StopInternal(result);
- return;
- }
-
- alljoyn_interfacedescription interfaceDescription = alljoyn_busattachment_getinterface(AllJoynHelpers::GetInternalBusAttachment(m_busAttachment), "com.microsoft.Samples.SecureInterface");
- if (interfaceDescription == nullptr)
- {
- StopInternal(ER_FAIL);
- return;
- }
- alljoyn_busobject_addinterface_announced(BusObject, interfaceDescription);
-
- result = AddMethodHandler(
- interfaceDescription,
- "Concatenate",
- [](alljoyn_busobject busObject, const alljoyn_interfacedescription_member* member, alljoyn_message message) { UNREFERENCED_PARAMETER(member); CallConcatenateHandler(busObject, message); });
- if (result != ER_OK)
- {
- StopInternal(result);
- return;
- }
-
- result = AddSignalHandler(
- AllJoynHelpers::GetInternalBusAttachment(m_busAttachment),
- interfaceDescription,
- "TextSent",
- [](const alljoyn_interfacedescription_member* member, PCSTR srcPath, alljoyn_message message) { UNREFERENCED_PARAMETER(srcPath); CallTextSentSignalHandler(member, message); });
- if (result != ER_OK)
- {
- StopInternal(result);
- return;
- }
-
- SourceObjects[m_busObject] = m_weak;
- SourceInterfaces[interfaceDescription] = m_weak;
-
- unsigned int noneMechanismIndex = 0;
- bool authenticationMechanismsContainsNone = m_busAttachment->AuthenticationMechanisms->IndexOf(AllJoynAuthenticationMechanism::None, &noneMechanismIndex);
- QCC_BOOL interfaceIsSecure = alljoyn_interfacedescription_issecure(interfaceDescription);
-
- // If the current set of AuthenticationMechanisms supports authentication,
- // determine whether a secure BusObject is required.
- if (AllJoynHelpers::CanSecure(m_busAttachment->AuthenticationMechanisms))
- {
- // Register the BusObject as "secure" if the org.alljoyn.Bus.Secure XML annotation
- // is specified, or if None is not present in AuthenticationMechanisms.
- if (!authenticationMechanismsContainsNone || interfaceIsSecure)
- {
- result = alljoyn_busattachment_registerbusobject_secure(AllJoynHelpers::GetInternalBusAttachment(m_busAttachment), BusObject);
- }
- else
- {
- result = alljoyn_busattachment_registerbusobject(AllJoynHelpers::GetInternalBusAttachment(m_busAttachment), BusObject);
- }
- }
- else
- {
- // If the current set of AuthenticationMechanisms does not support authentication
- // but the interface requires security, report an error.
- if (interfaceIsSecure)
- {
- result = ER_BUS_NO_AUTHENTICATION_MECHANISM;
- }
- else
- {
- result = alljoyn_busattachment_registerbusobject(AllJoynHelpers::GetInternalBusAttachment(m_busAttachment), BusObject);
- }
- }
-
- if (result != ER_OK)
- {
- StopInternal(result);
- return;
- }
-
- m_busAttachmentStateChangedToken = m_busAttachment->StateChanged += ref new TypedEventHandler(this, &SecureInterfaceProducer::BusAttachmentStateChanged);
- m_busAttachment->Connect();
-}
-
-void SecureInterfaceProducer::Stop()
-{
- StopInternal(AllJoynStatus::Ok);
-}
-
-void SecureInterfaceProducer::StopInternal(int32 status)
-{
- UnregisterFromBus();
- Stopped(this, ref new AllJoynProducerStoppedEventArgs(status));
-}
-
-int32 SecureInterfaceProducer::RemoveMemberFromSession(_In_ String^ uniqueName)
-{
- return alljoyn_busattachment_removesessionmember(
- AllJoynHelpers::GetInternalBusAttachment(m_busAttachment),
- m_sessionId,
- AllJoynHelpers::PlatformToMultibyteString(uniqueName).data());
-}
-
-PCSTR com::microsoft::Samples::SecureInterface::c_SecureInterfaceIntrospectionXml = ""
-" A secure AllJoyn sample "
-" "
-" "
-" Concatenate two input strings and returns the concatenated string as output "
-" "
-" "
-" "
-" "
-" "
-" Determine if the output of the Concatenate method is returned as upper case string or not "
-" "
-" "
-" "
-" This signal is emitted when producer sends a text message to consumer "
-" "
-" "
-" "
-;
\ No newline at end of file
diff --git a/Samples/AllJoyn/Common/Scenario1WinRTComponent/SecureInterfaceProducer.h b/Samples/AllJoyn/Common/Scenario1WinRTComponent/SecureInterfaceProducer.h
deleted file mode 100644
index bc79c29320..0000000000
--- a/Samples/AllJoyn/Common/Scenario1WinRTComponent/SecureInterfaceProducer.h
+++ /dev/null
@@ -1,246 +0,0 @@
-//*********************************************************
-//
-// Copyright (c) Microsoft. All rights reserved.
-// This code is licensed under the MIT License (MIT).
-// THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
-// ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
-// IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
-// PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
-//
-//*********************************************************
-//-----------------------------------------------------------------------------
-//
-// This code was generated by a tool.
-//
-// Changes to this file may cause incorrect behavior and will be lost if
-// the code is regenerated.
-//
-// For more information, see: http://go.microsoft.com/fwlink/?LinkID=623246
-//
-//-----------------------------------------------------------------------------
-#pragma once
-
-namespace com { namespace microsoft { namespace Samples { namespace SecureInterface {
-
-extern PCSTR c_SecureInterfaceIntrospectionXml;
-
-ref class SecureInterfaceProducer;
-
-public interface class ISecureInterfaceProducer
-{
- event Windows::Foundation::TypedEventHandler^ Stopped;
- event Windows::Foundation::TypedEventHandler^ SessionLost;
- event Windows::Foundation::TypedEventHandler^ SessionMemberAdded;
- event Windows::Foundation::TypedEventHandler^ SessionMemberRemoved;
-};
-
-public ref class SecureInterfaceProducer sealed : [Windows::Foundation::Metadata::Default] ISecureInterfaceProducer
-{
-public:
- SecureInterfaceProducer(Windows::Devices::AllJoyn::AllJoynBusAttachment^ busAttachment);
- virtual ~SecureInterfaceProducer();
-
- // The implementation of ISecureInterfaceService that will handle method calls and property requests.
- property ISecureInterfaceService^ Service
- {
- ISecureInterfaceService^ get() { return m_serviceInterface; }
- void set(ISecureInterfaceService^ value) { m_serviceInterface = value; }
- }
-
- // Used to send signals or register functions to handle received signals.
- property SecureInterfaceLegacySignals^ Signals
- {
- SecureInterfaceLegacySignals^ get() { return m_signals; }
- }
-
- // This event will fire whenever this producer is stopped.
- virtual event Windows::Foundation::TypedEventHandler^ Stopped
- {
- Windows::Foundation::EventRegistrationToken add(Windows::Foundation::TypedEventHandler^ handler)
- {
- return _Stopped += ref new Windows::Foundation::EventHandler
- ([handler](Platform::Object^ sender, Platform::Object^ args)
- {
- handler->Invoke(safe_cast(sender), safe_cast(args));
- }, Platform::CallbackContext::Same);
- }
- void remove(Windows::Foundation::EventRegistrationToken token)
- {
- _Stopped -= token;
- }
- internal:
- void raise(SecureInterfaceProducer^ sender, Windows::Devices::AllJoyn::AllJoynProducerStoppedEventArgs^ args)
- {
- _Stopped(sender, args);
- }
- }
-
- // This event will fire whenever the producer loses the session that it created.
- virtual event Windows::Foundation::TypedEventHandler^ SessionLost
- {
- Windows::Foundation::EventRegistrationToken add(Windows::Foundation::TypedEventHandler^ handler)
- {
- return _SessionLost += ref new Windows::Foundation::EventHandler
- ([handler](Platform::Object^ sender, Platform::Object^ args)
- {
- handler->Invoke(safe_cast(sender), safe_cast(args));
- }, Platform::CallbackContext::Same);
- }
- void remove(Windows::Foundation::EventRegistrationToken token)
- {
- _SessionLost -= token;
- }
- internal:
- void raise(SecureInterfaceProducer^ sender, Windows::Devices::AllJoyn::AllJoynSessionLostEventArgs^ args)
- {
- _SessionLost(sender, args);
- }
- }
-
- // This event will fire whenever a member joins the session.
- virtual event Windows::Foundation::TypedEventHandler^ SessionMemberAdded
- {
- Windows::Foundation::EventRegistrationToken add(Windows::Foundation::TypedEventHandler^ handler)
- {
- return _SessionMemberAdded += ref new Windows::Foundation::EventHandler
- ([handler](Platform::Object^ sender, Platform::Object^ args)
- {
- handler->Invoke(safe_cast(sender), safe_cast(args));
- }, Platform::CallbackContext::Same);
- }
- void remove(Windows::Foundation::EventRegistrationToken token)
- {
- _SessionMemberAdded -= token;
- }
- internal:
- void raise(SecureInterfaceProducer^ sender, Windows::Devices::AllJoyn::AllJoynSessionMemberAddedEventArgs^ args)
- {
- _SessionMemberAdded(sender, args);
- }
- }
-
- // This event will fire whenever a member leaves the session.
- virtual event Windows::Foundation::TypedEventHandler^ SessionMemberRemoved
- {
- Windows::Foundation::EventRegistrationToken add(Windows::Foundation::TypedEventHandler^ handler)
- {
- return _SessionMemberRemoved += ref new Windows::Foundation::EventHandler
- ([handler](Platform::Object^ sender, Platform::Object^ args)
- {
- handler->Invoke(safe_cast(sender), safe_cast(args));
- }, Platform::CallbackContext::Same);
- }
- void remove(Windows::Foundation::EventRegistrationToken token)
- {
- _SessionMemberRemoved -= token;
- }
- internal:
- void raise(SecureInterfaceProducer^ sender, Windows::Devices::AllJoyn::AllJoynSessionMemberRemovedEventArgs^ args)
- {
- _SessionMemberRemoved(sender, args);
- }
- }
-
- // Send a signal to all members of the session to notify them that the value of IsUpperCaseEnabled has changed.
- void EmitIsUpperCaseEnabledChanged();
-
- // Start advertising the service.
- void Start();
-
- // Stop advertising the service.
- void Stop();
-
- // Remove a member that has joined this session.
- int32 RemoveMemberFromSession(_In_ Platform::String^ uniqueName);
-
-internal:
- bool OnAcceptSessionJoiner(_In_ alljoyn_sessionport sessionPort, _In_ PCSTR joiner, _In_ const alljoyn_sessionopts opts);
- void OnSessionJoined(_In_ alljoyn_sessionport sessionPort, _In_ alljoyn_sessionid id, _In_ PCSTR joiner);
- QStatus OnPropertyGet(_In_ PCSTR interfaceName, _In_ PCSTR propertyName, _Inout_ alljoyn_msgarg val);
- QStatus OnPropertySet(_In_ PCSTR interfaceName, _In_ PCSTR propertyName, _In_ alljoyn_msgarg val);
- void OnSessionLost(_In_ alljoyn_sessionid sessionId, _In_ alljoyn_sessionlostreason reason);
- void OnSessionMemberAdded(_In_ alljoyn_sessionid sessionId, _In_ PCSTR uniqueName);
- void OnSessionMemberRemoved(_In_ alljoyn_sessionid sessionId, _In_ PCSTR uniqueName);
-
- property Platform::String^ ServiceObjectPath
- {
- Platform::String^ get() { return m_ServiceObjectPath; }
- void set(Platform::String^ value) { m_ServiceObjectPath = value; }
- }
-
- property alljoyn_busobject BusObject
- {
- alljoyn_busobject get() { return m_busObject; }
- void set(alljoyn_busobject value) { m_busObject = value; }
- }
-
- property alljoyn_sessionportlistener SessionPortListener
- {
- alljoyn_sessionportlistener get() { return m_sessionPortListener; }
- void set(alljoyn_sessionportlistener value) { m_sessionPortListener = value; }
- }
-
- property alljoyn_sessionlistener SessionListener
- {
- alljoyn_sessionlistener get() { return m_sessionListener; }
- void set(alljoyn_sessionlistener value) { m_sessionListener = value; }
- }
-
- property alljoyn_sessionport SessionPort
- {
- alljoyn_sessionport get() { return m_sessionPort; }
- internal:
- void set(alljoyn_sessionport value) { m_sessionPort = value; }
- }
-
- property alljoyn_sessionid SessionId
- {
- alljoyn_sessionid get() { return m_sessionId; }
- }
-
- // Stop advertising the service and pass status to anyone listening for the Stopped event.
- void StopInternal(int32 status);
-
- void BusAttachmentStateChanged(_In_ Windows::Devices::AllJoyn::AllJoynBusAttachment^ sender, _In_ Windows::Devices::AllJoyn::AllJoynBusAttachmentStateChangedEventArgs^ args);
-
-private:
- virtual event Windows::Foundation::EventHandler^ _Stopped;
- virtual event Windows::Foundation::EventHandler^ _SessionLost;
- virtual event Windows::Foundation::EventHandler^ _SessionMemberAdded;
- virtual event Windows::Foundation::EventHandler^ _SessionMemberRemoved;
-
- // "Concatenate two input strings and returns the concatenated string as output"
- static void CallConcatenateHandler(_Inout_ alljoyn_busobject busObject, _In_ alljoyn_message message);
- // "This signal is emitted when producer sends a text message to consumer"
- static void CallTextSentSignalHandler(_In_ const alljoyn_interfacedescription_member* member, _In_ alljoyn_message message);
-
- // Register a callback function to handle methods.
- QStatus AddMethodHandler(_In_ alljoyn_interfacedescription interfaceDescription, _In_ PCSTR methodName, _In_ alljoyn_messagereceiver_methodhandler_ptr handler);
- // Register a callback function to handle incoming signals.
- QStatus AddSignalHandler(_In_ alljoyn_busattachment busAttachment, _In_ alljoyn_interfacedescription interfaceDescription, _In_ PCSTR methodName, _In_ alljoyn_messagereceiver_signalhandler_ptr handler);
-
- void UnregisterFromBus();
-
- Windows::Devices::AllJoyn::AllJoynBusAttachment^ m_busAttachment;
- Windows::Foundation::EventRegistrationToken m_busAttachmentStateChangedToken;
- SecureInterfaceLegacySignals^ m_signals;
- ISecureInterfaceService^ m_serviceInterface;
- Platform::String^ m_ServiceObjectPath;
-
- alljoyn_busobject m_busObject;
- alljoyn_sessionportlistener m_sessionPortListener;
- alljoyn_sessionlistener m_sessionListener;
- alljoyn_sessionport m_sessionPort;
- alljoyn_sessionid m_sessionId;
-
- // Used to pass a pointer to this class to callbacks
- Platform::WeakReference* m_weak;
-
- // These maps are required because we need a way to pass the producer to the method
- // and signal handlers, but the current AllJoyn C API does not allow passing a context to these
- // callbacks.
- static std::map SourceObjects;
- static std::map SourceInterfaces;
-};
-
-} } } }
\ No newline at end of file
diff --git a/Samples/AllJoyn/Common/Scenario1WinRTComponent/SecureInterfaceServiceEventAdapter.cpp b/Samples/AllJoyn/Common/Scenario1WinRTComponent/SecureInterfaceServiceEventAdapter.cpp
deleted file mode 100644
index 39df1b9014..0000000000
--- a/Samples/AllJoyn/Common/Scenario1WinRTComponent/SecureInterfaceServiceEventAdapter.cpp
+++ /dev/null
@@ -1,58 +0,0 @@
-//*********************************************************
-//
-// Copyright (c) Microsoft. All rights reserved.
-// This code is licensed under the MIT License (MIT).
-// THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
-// ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
-// IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
-// PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
-//
-//*********************************************************
-//-----------------------------------------------------------------------------
-//
-// This code was generated by a tool.
-//
-// Changes to this file may cause incorrect behavior and will be lost if
-// the code is regenerated.
-//
-// For more information, see: http://go.microsoft.com/fwlink/?LinkID=623246
-//
-//-----------------------------------------------------------------------------
-#include "pch.h"
-
-using namespace Microsoft::WRL;
-using namespace Platform;
-using namespace Windows::Foundation;
-using namespace Windows::Foundation::Collections;
-using namespace Windows::Devices::AllJoyn;
-using namespace com::microsoft::Samples::SecureInterface;
-
-// Note: Unlike an Interface implementation, which provides a single handler for each member, the event
-// model allows for 0 or more listeners to be registered. The EventAdapter implementation deals with this
-// difference by implementing a last-writer-wins policy. The lack of any return value (i.e., 0 listeners)
-// is handled by returning a null result.
-
-// Methods
-IAsyncOperation^ SecureInterfaceServiceEventAdapter::ConcatenateAsync(_In_ AllJoynMessageInfo^ info, _In_ Platform::String^ interfaceMemberInStr1, _In_ Platform::String^ interfaceMemberInStr2)
-{
- auto args = ref new SecureInterfaceConcatenateCalledEventArgs(info, interfaceMemberInStr1, interfaceMemberInStr2);
- ConcatenateCalled(this, args);
- return SecureInterfaceConcatenateCalledEventArgs::GetResultAsync(args);
-}
-
-// Property Reads
-IAsyncOperation^ SecureInterfaceServiceEventAdapter::GetIsUpperCaseEnabledAsync(_In_ AllJoynMessageInfo^ info)
-{
- auto args = ref new SecureInterfaceGetIsUpperCaseEnabledRequestedEventArgs(info);
- GetIsUpperCaseEnabledRequested(this, args);
- return SecureInterfaceGetIsUpperCaseEnabledRequestedEventArgs::GetResultAsync(args);
-}
-
-// Property Writes
-IAsyncOperation^ SecureInterfaceServiceEventAdapter::SetIsUpperCaseEnabledAsync(_In_ AllJoynMessageInfo^ info, _In_ bool value)
-{
- auto args = ref new SecureInterfaceSetIsUpperCaseEnabledRequestedEventArgs(info, value);
- SetIsUpperCaseEnabledRequested(this, args);
- return SecureInterfaceSetIsUpperCaseEnabledRequestedEventArgs::GetResultAsync(args);
-}
-
diff --git a/Samples/AllJoyn/Common/Scenario1WinRTComponent/SecureInterfaceServiceEventAdapter.h b/Samples/AllJoyn/Common/Scenario1WinRTComponent/SecureInterfaceServiceEventAdapter.h
deleted file mode 100644
index 1824eb9bff..0000000000
--- a/Samples/AllJoyn/Common/Scenario1WinRTComponent/SecureInterfaceServiceEventAdapter.h
+++ /dev/null
@@ -1,110 +0,0 @@
-//*********************************************************
-//
-// Copyright (c) Microsoft. All rights reserved.
-// This code is licensed under the MIT License (MIT).
-// THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
-// ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
-// IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
-// PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
-//
-//*********************************************************
-//-----------------------------------------------------------------------------
-//
-// This code was generated by a tool.
-//
-// Changes to this file may cause incorrect behavior and will be lost if
-// the code is regenerated.
-//
-// For more information, see: http://go.microsoft.com/fwlink/?LinkID=623246
-//
-//-----------------------------------------------------------------------------
-#pragma once
-
-namespace com { namespace microsoft { namespace Samples { namespace SecureInterface {
-
-// This class, and the associated EventArgs classes, exist for the benefit of JavaScript developers who
-// do not have the ability to implement ISecureInterfaceService. Instead, SecureInterfaceServiceEventAdapter
-// provides the Interface implementation and exposes a set of compatible events to the developer.
-public ref class SecureInterfaceServiceEventAdapter sealed : [Windows::Foundation::Metadata::Default] ISecureInterfaceService
-{
-public:
- // Method Invocation Events
- event Windows::Foundation::TypedEventHandler^ ConcatenateCalled
- {
- Windows::Foundation::EventRegistrationToken add(Windows::Foundation::TypedEventHandler^ handler)
- {
- return _ConcatenateCalled += ref new Windows::Foundation::EventHandler
- ([handler](Platform::Object^ sender, Platform::Object^ args)
- {
- handler->Invoke(safe_cast(sender), safe_cast(args));
- }, Platform::CallbackContext::Same);
- }
- void remove(Windows::Foundation::EventRegistrationToken token)
- {
- _ConcatenateCalled -= token;
- }
- internal:
- void raise(SecureInterfaceServiceEventAdapter^ sender, SecureInterfaceConcatenateCalledEventArgs^ args)
- {
- _ConcatenateCalled(sender, args);
- }
- }
-
- // Property Read Events
- event Windows::Foundation::TypedEventHandler^ GetIsUpperCaseEnabledRequested
- {
- Windows::Foundation::EventRegistrationToken add(Windows::Foundation::TypedEventHandler^ handler)
- {
- return _GetIsUpperCaseEnabledRequested += ref new Windows::Foundation::EventHandler
- ([handler](Platform::Object^ sender, Platform::Object^ args)
- {
- handler->Invoke(safe_cast(sender), safe_cast(args));
- }, Platform::CallbackContext::Same);
- }
- void remove(Windows::Foundation::EventRegistrationToken token)
- {
- _GetIsUpperCaseEnabledRequested -= token;
- }
- internal:
- void raise(SecureInterfaceServiceEventAdapter^ sender, SecureInterfaceGetIsUpperCaseEnabledRequestedEventArgs^ args)
- {
- _GetIsUpperCaseEnabledRequested(sender, args);
- }
- }
-
- // Property Write Events
- event Windows::Foundation::TypedEventHandler^ SetIsUpperCaseEnabledRequested
- {
- Windows::Foundation::EventRegistrationToken add(Windows::Foundation::TypedEventHandler^ handler)
- {
- return _SetIsUpperCaseEnabledRequested += ref new Windows::Foundation::EventHandler
- ([handler](Platform::Object^ sender, Platform::Object^ args)
- {
- handler->Invoke(safe_cast(sender), safe_cast(args));
- }, Platform::CallbackContext::Same);
- }
- void remove(Windows::Foundation::EventRegistrationToken token)
- {
- _SetIsUpperCaseEnabledRequested -= token;
- }
- internal:
- void raise(SecureInterfaceServiceEventAdapter^ sender, SecureInterfaceSetIsUpperCaseEnabledRequestedEventArgs^ args)
- {
- _SetIsUpperCaseEnabledRequested(sender, args);
- }
- }
-
- // ISecureInterfaceService Implementation
- virtual Windows::Foundation::IAsyncOperation^ ConcatenateAsync(_In_ Windows::Devices::AllJoyn::AllJoynMessageInfo^ info, _In_ Platform::String^ interfaceMemberInStr1, _In_ Platform::String^ interfaceMemberInStr2);
-
- virtual Windows::Foundation::IAsyncOperation^ GetIsUpperCaseEnabledAsync(_In_ Windows::Devices::AllJoyn::AllJoynMessageInfo^ info);
-
- virtual Windows::Foundation::IAsyncOperation^ SetIsUpperCaseEnabledAsync(_In_ Windows::Devices::AllJoyn::AllJoynMessageInfo^ info, _In_ bool value);
-
-private:
- event Windows::Foundation::EventHandler^ _ConcatenateCalled;
- event Windows::Foundation::EventHandler^ _GetIsUpperCaseEnabledRequested;
- event Windows::Foundation::EventHandler^ _SetIsUpperCaseEnabledRequested;
-};
-
-} } } }
diff --git a/Samples/AllJoyn/Common/Scenario1WinRTComponent/SecureInterfaceServiceEventArgs.cpp b/Samples/AllJoyn/Common/Scenario1WinRTComponent/SecureInterfaceServiceEventArgs.cpp
deleted file mode 100644
index 19021f61df..0000000000
--- a/Samples/AllJoyn/Common/Scenario1WinRTComponent/SecureInterfaceServiceEventArgs.cpp
+++ /dev/null
@@ -1,266 +0,0 @@
-//*********************************************************
-//
-// Copyright (c) Microsoft. All rights reserved.
-// This code is licensed under the MIT License (MIT).
-// THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
-// ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
-// IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
-// PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
-//
-//*********************************************************
-//-----------------------------------------------------------------------------
-//
-// This code was generated by a tool.
-//
-// Changes to this file may cause incorrect behavior and will be lost if
-// the code is regenerated.
-//
-// For more information, see: http://go.microsoft.com/fwlink/?LinkID=623246
-//
-//-----------------------------------------------------------------------------
-#include "pch.h"
-
-using namespace concurrency;
-using namespace Microsoft::WRL;
-using namespace Platform;
-using namespace Windows::Foundation;
-using namespace Windows::Foundation::Collections;
-using namespace Windows::Devices::AllJoyn;
-using namespace com::microsoft::Samples::SecureInterface;
-namespace com { namespace microsoft { namespace Samples { namespace SecureInterface {
-
-// Methods
-SecureInterfaceConcatenateCalledEventArgs::SecureInterfaceConcatenateCalledEventArgs(
- _In_ AllJoynMessageInfo^ info,
- _In_ Platform::String^ interfaceMemberInStr1,
- _In_ Platform::String^ interfaceMemberInStr2)
- : m_raised(false),
- m_completionsRequired(0),
- m_messageInfo(info),
- m_interfaceMemberInStr1(interfaceMemberInStr1),
- m_interfaceMemberInStr2(interfaceMemberInStr2)
-{
- m_result = SecureInterfaceConcatenateResult::CreateFailureResult(ER_NOT_IMPLEMENTED);
-}
-
-Deferral^ SecureInterfaceConcatenateCalledEventArgs::GetDeferral()
-{
- std::lock_guard lockGuard(m_lock);
- if (m_raised)
- {
- // Cannot ask for a deferral after the event handler has returned.
- throw Exception::CreateException(E_ILLEGAL_METHOD_CALL);
- }
-
- m_completionsRequired++;
- auto handler = ref new DeferralCompletedHandler(this, &SecureInterfaceConcatenateCalledEventArgs::Complete);
- return ref new Deferral(handler);
-}
-
-void SecureInterfaceConcatenateCalledEventArgs::InvokeAllFinished()
-{
- bool invokeNeeded;
-
- // We need to hold a lock while modifying private state, but release it before invoking a completion handler.
- {
- std::lock_guard lockGuard(m_lock);
- m_raised = true;
- invokeNeeded = (m_completionsRequired == 0);
- }
-
- if (invokeNeeded)
- {
- InvokeCompleteHandler();
- }
-}
-
-void SecureInterfaceConcatenateCalledEventArgs::Complete()
-{
- bool invokeNeeded;
-
- // We need to hold a lock while modifying private state, but release it before invoking a completion handler.
- {
- std::lock_guard lockGuard(m_lock);
- if (m_completionsRequired == 0)
- {
- // This should never happen since Complete() should only be called by Windows.Foundation.Deferral
- // which will only invoke our completion handler once.
- throw Exception::CreateException(E_ILLEGAL_METHOD_CALL);
- }
- m_completionsRequired--;
- invokeNeeded = (m_raised && (m_completionsRequired == 0));
- }
-
- if (invokeNeeded)
- {
- InvokeCompleteHandler();
- }
-}
-
-void SecureInterfaceConcatenateCalledEventArgs::InvokeCompleteHandler()
-{
- if (m_result->Status == ER_NOT_IMPLEMENTED)
- {
- throw Exception::CreateException(E_NOTIMPL, "No handlers are registered for ConcatenateCalled.");
- }
- else
- {
- m_tce.set(m_result);
- }
-}
-
-// Readable Properties
-SecureInterfaceGetIsUpperCaseEnabledRequestedEventArgs::SecureInterfaceGetIsUpperCaseEnabledRequestedEventArgs(
- _In_ AllJoynMessageInfo^ info)
- : m_raised(false),
- m_completionsRequired(0),
- m_messageInfo(info)
-{
- m_result = SecureInterfaceGetIsUpperCaseEnabledResult::CreateFailureResult(ER_NOT_IMPLEMENTED);
-}
-
-Deferral^ SecureInterfaceGetIsUpperCaseEnabledRequestedEventArgs::GetDeferral()
-{
- std::lock_guard lockGuard(m_lock);
- if (m_raised)
- {
- // Cannot ask for a deferral after the event handler has returned.
- throw Exception::CreateException(E_ILLEGAL_METHOD_CALL);
- }
-
- m_completionsRequired++;
- auto handler = ref new DeferralCompletedHandler(this, &SecureInterfaceGetIsUpperCaseEnabledRequestedEventArgs::Complete);
- return ref new Deferral(handler);
-}
-
-void SecureInterfaceGetIsUpperCaseEnabledRequestedEventArgs::InvokeAllFinished()
-{
- bool invokeNeeded;
-
- // We need to hold a lock while modifying private state, but release it before invoking a completion handler.
- {
- std::lock_guard lockGuard(m_lock);
- m_raised = true;
- invokeNeeded = (m_completionsRequired == 0);
- }
-
- if (invokeNeeded)
- {
- InvokeCompleteHandler();
- }
-}
-
-void SecureInterfaceGetIsUpperCaseEnabledRequestedEventArgs::Complete()
-{
- bool invokeNeeded;
-
- // We need to hold a lock while modifying private state, but release it before invoking a completion handler.
- {
- std::lock_guard lockGuard(m_lock);
- if (m_completionsRequired == 0)
- {
- // This should never happen since Complete() should only be called by Windows.Foundation.Deferral
- // which will only invoke our completion handler once.
- throw Exception::CreateException(E_ILLEGAL_METHOD_CALL);
- }
- m_completionsRequired--;
- invokeNeeded = (m_raised && (m_completionsRequired == 0));
- }
-
- if (invokeNeeded)
- {
- InvokeCompleteHandler();
- }
-}
-
-void SecureInterfaceGetIsUpperCaseEnabledRequestedEventArgs::InvokeCompleteHandler()
-{
- if (m_result->Status == ER_NOT_IMPLEMENTED)
- {
- throw Exception::CreateException(E_NOTIMPL, "No handlers are registered for GetIsUpperCaseEnabledRequested.");
- }
- else
- {
- m_tce.set(m_result);
- }
-}
-
-// Writable Properties
-SecureInterfaceSetIsUpperCaseEnabledRequestedEventArgs::SecureInterfaceSetIsUpperCaseEnabledRequestedEventArgs(
- _In_ AllJoynMessageInfo^ info,
- _In_ bool value)
- : m_raised(false),
- m_completionsRequired(0),
- m_messageInfo(info),
- m_value(value)
-{
- m_result = SecureInterfaceSetIsUpperCaseEnabledResult::CreateFailureResult(ER_NOT_IMPLEMENTED);
-}
-
-Deferral^ SecureInterfaceSetIsUpperCaseEnabledRequestedEventArgs::GetDeferral()
-{
- std::lock_guard lockGuard(m_lock);
- if (m_raised)
- {
- // Cannot ask for a deferral after the event handler has returned.
- throw Exception::CreateException(E_ILLEGAL_METHOD_CALL);
- }
-
- m_completionsRequired++;
- auto handler = ref new DeferralCompletedHandler(this, &SecureInterfaceSetIsUpperCaseEnabledRequestedEventArgs::Complete);
- return ref new Deferral(handler);
-}
-
-void SecureInterfaceSetIsUpperCaseEnabledRequestedEventArgs::InvokeAllFinished()
-{
- bool invokeNeeded;
-
- // We need to hold a lock while modifying private state, but release it before invoking a completion handler.
- {
- std::lock_guard lockGuard(m_lock);
- m_raised = true;
- invokeNeeded = (m_completionsRequired == 0);
- }
-
- if (invokeNeeded)
- {
- InvokeCompleteHandler();
- }
-}
-
-void SecureInterfaceSetIsUpperCaseEnabledRequestedEventArgs::Complete()
-{
- bool invokeNeeded;
-
- // We need to hold a lock while modifying private state, but release it before invoking a completion handler.
- {
- std::lock_guard lockGuard(m_lock);
- if (m_completionsRequired == 0)
- {
- // This should never happen since Complete() should only be called by Windows.Foundation.Deferral
- // which will only invoke our completion handler once.
- throw Exception::CreateException(E_ILLEGAL_METHOD_CALL);
- }
- m_completionsRequired--;
- invokeNeeded = (m_raised && (m_completionsRequired == 0));
- }
-
- if (invokeNeeded)
- {
- InvokeCompleteHandler();
- }
-}
-
-void SecureInterfaceSetIsUpperCaseEnabledRequestedEventArgs::InvokeCompleteHandler()
-{
- if (m_result->Status == ER_NOT_IMPLEMENTED)
- {
- throw Exception::CreateException(E_NOTIMPL, "No handlers are registered for SetIsUpperCaseEnabledRequested.");
- }
- else
- {
- m_tce.set(m_result);
- }
-}
-
-} } } }
diff --git a/Samples/AllJoyn/Common/Scenario1WinRTComponent/SecureInterfaceServiceEventArgs.h b/Samples/AllJoyn/Common/Scenario1WinRTComponent/SecureInterfaceServiceEventArgs.h
deleted file mode 100644
index 68e0f0f19e..0000000000
--- a/Samples/AllJoyn/Common/Scenario1WinRTComponent/SecureInterfaceServiceEventArgs.h
+++ /dev/null
@@ -1,169 +0,0 @@
-//*********************************************************
-//
-// Copyright (c) Microsoft. All rights reserved.
-// This code is licensed under the MIT License (MIT).
-// THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
-// ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
-// IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
-// PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
-//
-//*********************************************************
-//-----------------------------------------------------------------------------
-//
-// This code was generated by a tool.
-//
-// Changes to this file may cause incorrect behavior and will be lost if
-// the code is regenerated.
-//
-// For more information, see: http://go.microsoft.com/fwlink/?LinkID=623246
-//
-//-----------------------------------------------------------------------------
-#pragma once
-
-namespace com { namespace microsoft { namespace Samples { namespace SecureInterface {
-
-// Methods
-public ref class SecureInterfaceConcatenateCalledEventArgs sealed
-{
-public:
- SecureInterfaceConcatenateCalledEventArgs(_In_ Windows::Devices::AllJoyn::AllJoynMessageInfo^ info, _In_ Platform::String^ interfaceMemberInStr1, _In_ Platform::String^ interfaceMemberInStr2);
-
- property Windows::Devices::AllJoyn::AllJoynMessageInfo^ MessageInfo
- {
- Windows::Devices::AllJoyn::AllJoynMessageInfo^ get() { return m_messageInfo; }
- }
-
- property SecureInterfaceConcatenateResult^ Result
- {
- SecureInterfaceConcatenateResult^ get() { return m_result; }
- void set(_In_ SecureInterfaceConcatenateResult^ value) { m_result = value; }
- }
-
- property Platform::String^ InStr1
- {
- Platform::String^ get() { return m_interfaceMemberInStr1; }
- }
-
- property Platform::String^ InStr2
- {
- Platform::String^ get() { return m_interfaceMemberInStr2; }
- }
-
- Windows::Foundation::Deferral^ GetDeferral();
-
- static Windows::Foundation::IAsyncOperation^ GetResultAsync(SecureInterfaceConcatenateCalledEventArgs^ args)
- {
- args->InvokeAllFinished();
- auto t = concurrency::create_task(args->m_tce);
- return concurrency::create_async([t]() -> concurrency::task
- {
- return t;
- });
- }
-
-private:
- void Complete();
- void InvokeAllFinished();
- void InvokeCompleteHandler();
-
- bool m_raised;
- int m_completionsRequired;
- concurrency::task_completion_event m_tce;
- std::mutex m_lock;
- Windows::Devices::AllJoyn::AllJoynMessageInfo^ m_messageInfo;
- SecureInterfaceConcatenateResult^ m_result;
- Platform::String^ m_interfaceMemberInStr1;
- Platform::String^ m_interfaceMemberInStr2;
-};
-
-// Readable Properties
-public ref class SecureInterfaceGetIsUpperCaseEnabledRequestedEventArgs sealed
-{
-public:
- SecureInterfaceGetIsUpperCaseEnabledRequestedEventArgs(_In_ Windows::Devices::AllJoyn::AllJoynMessageInfo^ info);
-
- property Windows::Devices::AllJoyn::AllJoynMessageInfo^ MessageInfo
- {
- Windows::Devices::AllJoyn::AllJoynMessageInfo^ get() { return m_messageInfo; }
- }
-
- property SecureInterfaceGetIsUpperCaseEnabledResult^ Result
- {
- SecureInterfaceGetIsUpperCaseEnabledResult^ get() { return m_result; }
- void set(_In_ SecureInterfaceGetIsUpperCaseEnabledResult^ value) { m_result = value; }
- }
-
- Windows::Foundation::Deferral^ GetDeferral();
-
- static Windows::Foundation::IAsyncOperation^ GetResultAsync(SecureInterfaceGetIsUpperCaseEnabledRequestedEventArgs^ args)
- {
- args->InvokeAllFinished();
- auto t = concurrency::create_task(args->m_tce);
- return concurrency::create_async([t]() -> concurrency::task
- {
- return t;
- });
- }
-
-private:
- void Complete();
- void InvokeAllFinished();
- void InvokeCompleteHandler();
-
- bool m_raised;
- int m_completionsRequired;
- concurrency::task_completion_event m_tce;
- std::mutex m_lock;
- Windows::Devices::AllJoyn::AllJoynMessageInfo^ m_messageInfo;
- SecureInterfaceGetIsUpperCaseEnabledResult^ m_result;
-};
-
-// Writable Properties
-public ref class SecureInterfaceSetIsUpperCaseEnabledRequestedEventArgs sealed
-{
-public:
- SecureInterfaceSetIsUpperCaseEnabledRequestedEventArgs(_In_ Windows::Devices::AllJoyn::AllJoynMessageInfo^ info, _In_ bool value);
-
- property Windows::Devices::AllJoyn::AllJoynMessageInfo^ MessageInfo
- {
- Windows::Devices::AllJoyn::AllJoynMessageInfo^ get() { return m_messageInfo; }
- }
-
- property bool Value
- {
- bool get() { return m_value; }
- }
-
- property SecureInterfaceSetIsUpperCaseEnabledResult^ Result
- {
- SecureInterfaceSetIsUpperCaseEnabledResult^ get() { return m_result; }
- void set(_In_ SecureInterfaceSetIsUpperCaseEnabledResult^ value) { m_result = value; }
- }
-
- static Windows::Foundation::IAsyncOperation^ GetResultAsync(SecureInterfaceSetIsUpperCaseEnabledRequestedEventArgs^ args)
- {
- args->InvokeAllFinished();
- auto t = concurrency::create_task(args->m_tce);
- return concurrency::create_async([t]() -> concurrency::task
- {
- return t;
- });
- }
-
- Windows::Foundation::Deferral^ GetDeferral();
-
-private:
- void Complete();
- void InvokeAllFinished();
- void InvokeCompleteHandler();
-
- bool m_raised;
- int m_completionsRequired;
- concurrency::task_completion_event m_tce;
- std::mutex m_lock;
- Windows::Devices::AllJoyn::AllJoynMessageInfo^ m_messageInfo;
- bool m_value;
- SecureInterfaceSetIsUpperCaseEnabledResult^ m_result;
-};
-
-} } } }
diff --git a/Samples/AllJoyn/Common/Scenario1WinRTComponent/SecureInterfaceSignals.cpp b/Samples/AllJoyn/Common/Scenario1WinRTComponent/SecureInterfaceSignals.cpp
deleted file mode 100644
index 7663d85e25..0000000000
--- a/Samples/AllJoyn/Common/Scenario1WinRTComponent/SecureInterfaceSignals.cpp
+++ /dev/null
@@ -1,66 +0,0 @@
-//*********************************************************
-//
-// Copyright (c) Microsoft. All rights reserved.
-// This code is licensed under the MIT License (MIT).
-// THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
-// ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
-// IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
-// PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
-//
-//*********************************************************
-//-----------------------------------------------------------------------------
-//
-// This code was generated by a tool.
-//
-// Changes to this file may cause incorrect behavior and will be lost if
-// the code is regenerated.
-//
-// For more information, see: http://go.microsoft.com/fwlink/?LinkID=623246
-//
-//-----------------------------------------------------------------------------
-#include "pch.h"
-
-using namespace Microsoft::WRL;
-using namespace Platform;
-using namespace Windows::Devices::AllJoyn;
-using namespace Windows::Foundation;
-using namespace com::microsoft::Samples::SecureInterface;
-
-void SecureInterfaceSignals::Initialize(_In_ ISignalEmitter^ emitter)
-{
- m_emitter = emitter;
- alljoyn_busattachment nativeBusAttachment = AllJoynHelpers::GetInternalBusAttachment(m_emitter->BusObject->BusAttachment);
- auto interfaceDefinition = alljoyn_busattachment_getinterface(nativeBusAttachment, "com.microsoft.Samples.SecureInterface");
- alljoyn_interfacedescription_getmember(interfaceDefinition, "TextSent", &m_memberTextSent);
-}
-
-void SecureInterfaceSignals::TextSent(_In_ Platform::String^ interfaceMemberMessage)
-{
- if (nullptr == AllJoynHelpers::GetInternalBusObject(m_emitter->BusObject))
- {
- return;
- }
-
- size_t argCount = 1;
- alljoyn_msgarg arguments = alljoyn_msgarg_array_create(argCount);
- (void)TypeConversionHelpers::SetAllJoynMessageArg(alljoyn_msgarg_array_element(arguments, 0), "s", interfaceMemberMessage);
-
- alljoyn_busobject_signal(
- AllJoynHelpers::GetInternalBusObject(m_emitter->BusObject),
- NULL, // Generated code only supports broadcast signals.
- m_emitter->Session->Id,
- m_memberTextSent,
- arguments,
- argCount,
- 0, // A signal with a TTL of 0 will be sent to every member of the session, regardless of how long it takes to deliver the message
- ALLJOYN_MESSAGE_FLAG_GLOBAL_BROADCAST, // Broadcast to everyone in the session.
- NULL); // The generated code does not need the generated signal message
-
- alljoyn_msgarg_destroy(arguments);
-}
-
-void SecureInterfaceSignals::CallTextSentReceived(_In_ SecureInterfaceSignals^ sender, _In_ SecureInterfaceTextSentReceivedEventArgs^ args)
-{
- TextSentReceived(sender, args);
-}
-
diff --git a/Samples/AllJoyn/Common/Scenario1WinRTComponent/SecureInterfaceSignals.h b/Samples/AllJoyn/Common/Scenario1WinRTComponent/SecureInterfaceSignals.h
deleted file mode 100644
index d3fd1adb00..0000000000
--- a/Samples/AllJoyn/Common/Scenario1WinRTComponent/SecureInterfaceSignals.h
+++ /dev/null
@@ -1,73 +0,0 @@
-//*********************************************************
-//
-// Copyright (c) Microsoft. All rights reserved.
-// This code is licensed under the MIT License (MIT).
-// THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
-// ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
-// IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
-// PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
-//
-//*********************************************************
-//-----------------------------------------------------------------------------
-//
-// This code was generated by a tool.
-//
-// Changes to this file may cause incorrect behavior and will be lost if
-// the code is regenerated.
-//
-// For more information, see: http://go.microsoft.com/fwlink/?LinkID=623246
-//
-//-----------------------------------------------------------------------------
-#pragma once
-
-namespace com { namespace microsoft { namespace Samples { namespace SecureInterface {
-
-ref class SecureInterfaceSignals;
-
-public interface class ISecureInterfaceSignals
-{
- event Windows::Foundation::TypedEventHandler^ TextSentReceived;
-};
-
-public ref class SecureInterfaceSignals sealed : [Windows::Foundation::Metadata::Default] ISecureInterfaceSignals
-{
-public:
- // "This signal is emitted when producer sends a text message to consumer"
- // Calling this method will send the TextSent signal to every member of the session.
- void TextSent(_In_ Platform::String^ interfaceMemberMessage);
-
- // This event fires whenever the TextSent signal is sent by another member of the session.
- virtual event Windows::Foundation::TypedEventHandler^ TextSentReceived
- {
- Windows::Foundation::EventRegistrationToken add(Windows::Foundation::TypedEventHandler^ handler)
- {
- return _TextSentReceived += ref new Windows::Foundation::EventHandler
- ([handler](Platform::Object^ sender, Platform::Object^ args)
- {
- handler->Invoke(safe_cast(sender), safe_cast(args));
- }, Platform::CallbackContext::Same);
- }
- void remove(Windows::Foundation::EventRegistrationToken token)
- {
- _TextSentReceived -= token;
- }
- internal:
- void raise(SecureInterfaceSignals^ sender, SecureInterfaceTextSentReceivedEventArgs^ args)
- {
- _TextSentReceived(sender, args);
- }
- }
-
-internal:
- void Initialize(_In_ ISignalEmitter^ emitter);
- void CallTextSentReceived(_In_ SecureInterfaceSignals^ sender, _In_ SecureInterfaceTextSentReceivedEventArgs^ args);
-
-private:
- ISignalEmitter^ m_emitter;
-
- virtual event Windows::Foundation::EventHandler^ _TextSentReceived;
-
- alljoyn_interfacedescription_member m_memberTextSent;
-};
-
-} } } }
diff --git a/Samples/AllJoyn/Common/Scenario1WinRTComponent/SecureInterfaceStructures.h b/Samples/AllJoyn/Common/Scenario1WinRTComponent/SecureInterfaceStructures.h
deleted file mode 100644
index c4473060c8..0000000000
--- a/Samples/AllJoyn/Common/Scenario1WinRTComponent/SecureInterfaceStructures.h
+++ /dev/null
@@ -1,108 +0,0 @@
-//*********************************************************
-//
-// Copyright (c) Microsoft. All rights reserved.
-// This code is licensed under the MIT License (MIT).
-// THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
-// ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
-// IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
-// PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
-//
-//*********************************************************
-//-----------------------------------------------------------------------------
-//
-// This code was generated by a tool.
-//
-// Changes to this file may cause incorrect behavior and will be lost if
-// the code is regenerated.
-//
-// For more information, see: http://go.microsoft.com/fwlink/?LinkID=623246
-//
-//-----------------------------------------------------------------------------
-#pragma once
-
-namespace com { namespace microsoft { namespace Samples { namespace SecureInterface {
-
-public ref class AllJoynMessageArgStructure sealed : Windows::Foundation::Collections::IVector
-{
-public:
- AllJoynMessageArgStructure()
- {
- m_vector = ref new Platform::Collections::Vector();
- }
-
- virtual Windows::Foundation::Collections::IIterator^ First()
- {
- return m_vector->First();
- }
-
- virtual Platform::Object^ GetAt(unsigned int index)
- {
- return m_vector->GetAt(index);
- }
-
- virtual property unsigned int Size {
- virtual unsigned int get()
- {
- return m_vector->Size;
- }
- }
-
- virtual bool IndexOf(Platform::Object^ value, unsigned int * index)
- {
- return m_vector->IndexOf(value, index);
- }
-
- virtual unsigned int GetMany(unsigned int startIndex, Platform::WriteOnlyArray^ items)
- {
- return m_vector->GetMany(startIndex, items);
- }
-
- virtual Windows::Foundation::Collections::IVectorView^ GetView()
- {
- return m_vector->GetView();
- }
-
- virtual void SetAt(unsigned int index, Platform::Object^ value)
- {
- return m_vector->SetAt(index, value);
- }
-
- virtual void InsertAt(unsigned int index, Platform::Object^ value)
- {
- return m_vector->InsertAt(index, value);
- }
-
- virtual void Append(Platform::Object^ value)
- {
- return m_vector->Append(value);
- }
-
- virtual void RemoveAt(unsigned int index)
- {
- return m_vector->RemoveAt(index);
- }
-
- virtual void RemoveAtEnd()
- {
- return m_vector->RemoveAtEnd();
- }
-
- virtual void Clear()
- {
- return m_vector->Clear();
- }
-
- virtual void ReplaceAll(const Platform::Array^ items)
- {
- return m_vector->ReplaceAll(items);
- }
-
-private:
- Platform::Collections::Vector^ m_vector;
-};
-} } } }
-
-partial ref class TypeConversionHelpers
-{
-internal:
-};
diff --git a/Samples/AllJoyn/Common/Scenario1WinRTComponent/pch.cpp b/Samples/AllJoyn/Common/Scenario1WinRTComponent/pch.cpp
deleted file mode 100644
index 4c5275e663..0000000000
--- a/Samples/AllJoyn/Common/Scenario1WinRTComponent/pch.cpp
+++ /dev/null
@@ -1,21 +0,0 @@
-//*********************************************************
-//
-// Copyright (c) Microsoft. All rights reserved.
-// This code is licensed under the MIT License (MIT).
-// THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
-// ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
-// IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
-// PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
-//
-//*********************************************************
-//-----------------------------------------------------------------------------
-//
-// This code was generated by a tool.
-//
-// Changes to this file may cause incorrect behavior and will be lost if
-// the code is regenerated.
-//
-// For more information, see: http://go.microsoft.com/fwlink/?LinkID=623246
-//
-//-----------------------------------------------------------------------------
-#include "pch.h"
diff --git a/Samples/AllJoyn/Common/Scenario1WinRTComponent/pch.h b/Samples/AllJoyn/Common/Scenario1WinRTComponent/pch.h
deleted file mode 100644
index 74ad51f3b1..0000000000
--- a/Samples/AllJoyn/Common/Scenario1WinRTComponent/pch.h
+++ /dev/null
@@ -1,52 +0,0 @@
-//*********************************************************
-//
-// Copyright (c) Microsoft. All rights reserved.
-// This code is licensed under the MIT License (MIT).
-// THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
-// ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
-// IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
-// PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
-//
-//*********************************************************
-
-//-----------------------------------------------------------------------------
-//
-// This code was generated by a tool.
-//
-// Changes to this file may cause incorrect behavior and will be lost if
-// the code is regenerated.
-//
-// For more information, see: http://go.microsoft.com/fwlink/?LinkID=623246
-//
-//-----------------------------------------------------------------------------
-#pragma once
-
-#include
-#include
-#include
-#include
-#include
-#include
-
-#include
-#include
-#include
-#include
-#include
-
-#include "AllJoynHelpers.h"
-#include "AllJoynBusObjectManager.h"
-
-#define PROJECT_NAMESPACE com::microsoft::Samples::SecureInterface
-
-#include "SecureInterfaceStructures.h"
-#include "TypeConversionHelpers.h"
-#include "SecureInterfaceMethodResults.h"
-#include "SecureInterfaceEventArgs.h"
-#include "ISecureInterfaceService.h"
-#include "SecureInterfaceSignals.h"
-#include "SecureInterfaceLegacySignals.h"
-#include "SecureInterfaceProducer.h"
-#include "SecureInterfaceConsumer.h"
-#include "SecureInterfaceServiceEventArgs.h"
-#include "SecureInterfaceServiceEventAdapter.h"
\ No newline at end of file
diff --git a/Samples/AllJoyn/Common/Scenario2WinRTComponent/AllJoynHelpers.h b/Samples/AllJoyn/Common/Scenario2WinRTComponent/AllJoynHelpers.h
deleted file mode 100644
index 1987e10a79..0000000000
--- a/Samples/AllJoyn/Common/Scenario2WinRTComponent/AllJoynHelpers.h
+++ /dev/null
@@ -1,277 +0,0 @@
-//*********************************************************
-//
-// Copyright (c) Microsoft. All rights reserved.
-// This code is licensed under the MIT License (MIT).
-// THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
-// ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
-// IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
-// PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
-//
-//*********************************************************
-//-----------------------------------------------------------------------------
-//
-// This code was generated by a tool.
-//
-// Changes to this file may cause incorrect behavior and will be lost if
-// the code is regenerated.
-//
-// For more information, see: http://go.microsoft.com/fwlink/?LinkID=623246
-//
-//-----------------------------------------------------------------------------
-#pragma once
-
-// The amount of time to wait (ms) for a response after sending a message before timing out.
-const int c_MessageTimeoutInMilliseconds = 10000;
-
-// The maximum length of an AllJoyn type signature allowed by the AllJoyn Core library.
-const int c_MaximumSignatureLength = 255;
-
-#define RETURN_IF_QSTATUS_ERROR(status) \
-{ \
-int32 alljoynStatus = static_cast(status); \
-if (Windows::Devices::AllJoyn::AllJoynStatus::Ok != alljoynStatus) \
-{ \
- return status; \
-} \
-}
-
-namespace org { namespace alljoyn { namespace Onboarding {
-
-public interface class ISignalEmitter
-{
- property Windows::Devices::AllJoyn::AllJoynBusObject^ BusObject
- {
- Windows::Devices::AllJoyn::AllJoynBusObject^ get();
- }
-
- property Windows::Devices::AllJoyn::AllJoynSession^ Session
- {
- Windows::Devices::AllJoyn::AllJoynSession^ get();
- }
-};
-
-} } }
-
-class AllJoynHelpers
-{
-public:
- // The Windows::Devices::AllJoyn::AllJoynBusAttachment class wraps the alljoyn_busattachment type. This
- // function gets the underlying alljoyn_busattachment.
- static alljoyn_busattachment GetInternalBusAttachment(_In_ Windows::Devices::AllJoyn::AllJoynBusAttachment^ busAttachment);
-
- // The Windows::Devices::AllJoyn::AllJoynBusObject class wraps the alljoyn_busobject type. This
- // function gets the underlying alljoyn_busobject.
- static alljoyn_busobject AllJoynHelpers::GetInternalBusObject(_In_ Windows::Devices::AllJoyn::AllJoynBusObject^ busObject);
-
- // Create the alljoyn_interfacedescriptions described in introspectionXml and add them to the busAttachment.
- static QStatus CreateInterfaces(_Inout_ Windows::Devices::AllJoyn::AllJoynBusAttachment^ busAttachment, _In_ PCSTR introspectionXml);
-
- // Convert a UTF8 string to a wide character Platform::String.
- static Platform::String^ MultibyteToPlatformString(_In_ PCSTR);
-
- // Convert a wide character Platform::String to a UTF8 string.
- static std::vector PlatformToMultibyteString(_In_ Platform::String^ str);
-
- // Get the service object path from an objectDescriptionArg. The objectDescriptionArg should
- // come from an Announce signal.
- static Platform::String^ GetObjectPath(_In_ alljoyn_aboutobjectdescription objectDescription, _In_ PCSTR interfaceName);
-
- // Determine whether the supplied set of AuthenticationMechanisms is sufficient for securing an AllJoyn connection.
- static bool CanSecure(_In_ Windows::Foundation::Collections::IVector^ authenticationMechanisms);
-
- // Callback for alljoyn_proxybusobject_listener_propertieschanged_ptr.
- // This callback expects the context to be of type T, which must implement the OnPropertyChanged function.
- template
- static void AJ_CALL PropertyChangedHandler(_In_ alljoyn_proxybusobject obj, _In_ PCSTR interfaceName, _In_ const alljoyn_msgarg changed, _In_ const alljoyn_msgarg invalidated, _In_ void* context)
- {
- T^ caller = static_cast(context)->Resolve();
- caller->OnPropertyChanged(obj, interfaceName, changed, invalidated);
- }
-
- // Callback for alljoyn_busobject_prop_get_ptr.
- template
- static QStatus AJ_CALL PropertyGetHandler(_In_ const void* context, _In_ PCSTR interfaceName, _In_ PCSTR propertyName, _In_ alljoyn_msgarg value)
- {
- T^ caller = static_cast(context)->Resolve();
- return caller->OnPropertyGet(interfaceName, propertyName, value);
- }
-
- // Callback for alljoyn_busobject_prop_set_ptr.
- template
- static QStatus AJ_CALL PropertySetHandler(_In_ const void* context, _In_ PCSTR interfaceName, _In_ PCSTR propertyName, _In_ alljoyn_msgarg value)
- {
- T^ caller = static_cast(context)->Resolve();
- return caller->OnPropertySet(interfaceName, propertyName, value);
- }
-
- // Callback for alljoyn_sessionlistener_sessionlost_ptr.
- template
- static void AJ_CALL SessionLostHandler(_In_ const void* context, _In_ alljoyn_sessionid sessionId, _In_ alljoyn_sessionlostreason reason)
- {
- T^ caller = static_cast(context)->Resolve();
- caller->OnSessionLost(sessionId, reason);
- }
-
- // Callback for alljoyn_sessionlistener_sessionmemberadded_ptr.
- template
- static void AJ_CALL SessionMemberAddedHandler(_In_ const void* context, _In_ alljoyn_sessionid sessionId, _In_ PCSTR uniqueName)
- {
- T^ caller = static_cast(context)->Resolve();
- caller->OnSessionMemberAdded(sessionId, uniqueName);
- }
-
- // Callback for alljoyn_sessionlistener_sessionmemberremoved_ptr.
- template
- static void AJ_CALL SessionMemberRemovedHandler(_In_ const void* context, _In_ alljoyn_sessionid sessionId, _In_ PCSTR uniqueName)
- {
- T^ caller = static_cast(context)->Resolve();
- caller->OnSessionMemberRemoved(sessionId, uniqueName);
- }
-
- // Create an AllJoyn bus object.
- template
- static QStatus CreateBusObject(_Inout_ Platform::WeakReference* target)
- {
- alljoyn_busobject_callbacks callbacks =
- {
- PropertyGetHandler,
- PropertySetHandler,
- nullptr,
- nullptr,
- };
-
- T^ caller = target->Resolve();
-
- auto serviceObjectPath = PlatformToMultibyteString(caller->ServiceObjectPath);
- alljoyn_busobject busObject = alljoyn_busobject_create(serviceObjectPath.data(), false, &callbacks, target);
- if (busObject == nullptr)
- {
- return ER_FAIL;
- }
-
- caller->BusObject = busObject;
-
- return ER_OK;
- }
-
- // Callback for alljoyn_sessionportlistener_acceptsessionjoiner_ptr.
- // This callback expects the context to be of type T, which must implement the OnAcceptSessionJoiner function.
- template
- static QCC_BOOL AJ_CALL AcceptSessionJoinerHandler(
- _In_ const void* context,
- _In_ alljoyn_sessionport sessionPort,
- _In_ PCSTR joiner,
- _In_ const alljoyn_sessionopts opts)
- {
- T^ caller = static_cast(context)->Resolve();
- return caller->OnAcceptSessionJoiner(sessionPort, joiner, opts);
- }
-
- // Callback for alljoyn_sessionportlistener_sessionjoined_ptr.
- // This callback expects the context to be of type T, which must implement the OnSessionJoined function.
- template
- static void AJ_CALL SessionJoinedHandler(
- _In_ const void* context,
- _In_ alljoyn_sessionport sessionPort,
- _In_ alljoyn_sessionid id,
- _In_ PCSTR joiner)
- {
- T^ caller = static_cast(context)->Resolve();
- caller->OnSessionJoined(sessionPort, id, joiner);
- }
-
- // Create the session for an AllJoyn producer.
- template
- static QStatus CreateProducerSession(_Inout_ Windows::Devices::AllJoyn::AllJoynBusAttachment^ busAttachment, _Inout_ Platform::WeakReference* target)
- {
- alljoyn_sessionopts opts = alljoyn_sessionopts_create(ALLJOYN_TRAFFIC_TYPE_MESSAGES, true, ALLJOYN_PROXIMITY_ANY, ALLJOYN_TRANSPORT_ANY);
-
- alljoyn_sessionportlistener_callbacks callbacks =
- {
- AcceptSessionJoinerHandler,
- SessionJoinedHandler
- };
-
- T^ producer = target->Resolve();
- producer->SessionPortListener = alljoyn_sessionportlistener_create(&callbacks, target);
-
- alljoyn_sessionport sessionPort = 42;
- alljoyn_busattachment_unbindsessionport(AllJoynHelpers::GetInternalBusAttachment(busAttachment), sessionPort);
- RETURN_IF_QSTATUS_ERROR(alljoyn_busattachment_bindsessionport(AllJoynHelpers::GetInternalBusAttachment(busAttachment), &sessionPort, opts, producer->SessionPortListener));
- producer->SessionPort = sessionPort;
-
- alljoyn_sessionopts_destroy(opts);
-
- return ER_OK;
- }
-};
-
-// Passed to property get callbacks to allow them to report when the async operation is completed.
-template
-class PropertyGetContext
-{
-public:
- void SetEvent()
- {
- m_event.set();
- }
-
- void Wait()
- {
- m_event.wait();
- }
-
- QStatus GetStatus()
- {
- return m_status;
- }
-
- void SetStatus(QStatus value)
- {
- m_status = value;
- }
-
- T GetValue()
- {
- return m_value;
- }
-
- void SetValue(T value)
- {
- m_value = value;
- }
-
-private:
- Concurrency::event m_event;
- QStatus m_status;
- T m_value;
-};
-
-// Passed to property set callbacks to allow them to report when the async operation is completed.
-class PropertySetContext
-{
-public:
- void SetEvent()
- {
- m_event.set();
- }
-
- void Wait()
- {
- m_event.wait();
- }
-
- QStatus GetStatus()
- {
- return m_status;
- }
-
- void SetStatus(QStatus value)
- {
- m_status = value;
- }
-
-private:
- Concurrency::event m_event;
- QStatus m_status;
-};
diff --git a/Samples/AllJoyn/Common/Scenario2WinRTComponent/IOnboardingService.h b/Samples/AllJoyn/Common/Scenario2WinRTComponent/IOnboardingService.h
deleted file mode 100644
index 65ba47eb2c..0000000000
--- a/Samples/AllJoyn/Common/Scenario2WinRTComponent/IOnboardingService.h
+++ /dev/null
@@ -1,64 +0,0 @@
-//*********************************************************
-//
-// Copyright (c) Microsoft. All rights reserved.
-// This code is licensed under the MIT License (MIT).
-// THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
-// ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
-// IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
-// PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
-//
-//*********************************************************
-//-----------------------------------------------------------------------------
-//
-// This code was generated by a tool.
-//
-// Changes to this file may cause incorrect behavior and will be lost if
-// the code is regenerated.
-//
-// For more information, see: http://go.microsoft.com/fwlink/?LinkID=623246
-//
-//-----------------------------------------------------------------------------
-#pragma once
-
-namespace org { namespace alljoyn { namespace Onboarding {
-
-public interface class IOnboardingService
-{
-public:
- // "Sends the personal AP information to the onboardee"
- // Implement this function to handle calls to the ConfigureWiFi method.
- Windows::Foundation::IAsyncOperation^ ConfigureWiFiAsync(_In_ Windows::Devices::AllJoyn::AllJoynMessageInfo^ info , _In_ Platform::String^ interfaceMemberSSID, _In_ Platform::String^ interfaceMemberPassphrase, _In_ int16 interfaceMemberAuthType);
-
- // "Tells the onboardee to connect to the personal AP"
- // Implement this function to handle calls to the Connect method.
- Windows::Foundation::IAsyncOperation^ ConnectAsync(_In_ Windows::Devices::AllJoyn::AllJoynMessageInfo^ info );
-
- // "Tells the onboardee to disconnect from the personal AP"
- // Implement this function to handle calls to the Offboard method.
- Windows::Foundation::IAsyncOperation^ OffboardAsync(_In_ Windows::Devices::AllJoyn::AllJoynMessageInfo^ info );
-
- // "Scans all the Wi-Fi access points in the onboardee's proximity"
- // Implement this function to handle calls to the GetScanInfo method.
- Windows::Foundation::IAsyncOperation^ GetScanInfoAsync(_In_ Windows::Devices::AllJoyn::AllJoynMessageInfo^ info );
-
- // "Interface version number"
- // Implement this function to handle requests for the value of the Version property.
- //
- // Currently, info will always be null, because no information is available about the requestor.
- Windows::Foundation::IAsyncOperation^ GetVersionAsync(Windows::Devices::AllJoyn::AllJoynMessageInfo^ info);
-
- // "The configuration state"
- // Implement this function to handle requests for the value of the State property.
- //
- // Currently, info will always be null, because no information is available about the requestor.
- Windows::Foundation::IAsyncOperation^ GetStateAsync(Windows::Devices::AllJoyn::AllJoynMessageInfo^ info);
-
- // "The last error code and error message"
- // Implement this function to handle requests for the value of the LastError property.
- //
- // Currently, info will always be null, because no information is available about the requestor.
- Windows::Foundation::IAsyncOperation^ GetLastErrorAsync(Windows::Devices::AllJoyn::AllJoynMessageInfo^ info);
-
-};
-
-} } }
diff --git a/Samples/AllJoyn/Common/Scenario2WinRTComponent/OnboardingConsumer.cpp b/Samples/AllJoyn/Common/Scenario2WinRTComponent/OnboardingConsumer.cpp
deleted file mode 100644
index 783f0f682b..0000000000
--- a/Samples/AllJoyn/Common/Scenario2WinRTComponent/OnboardingConsumer.cpp
+++ /dev/null
@@ -1,563 +0,0 @@
-//*********************************************************
-//
-// Copyright (c) Microsoft. All rights reserved.
-// This code is licensed under the MIT License (MIT).
-// THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
-// ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
-// IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
-// PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
-//
-//*********************************************************
-//-----------------------------------------------------------------------------
-//
-// This code was generated by a tool.
-//
-// Changes to this file may cause incorrect behavior and will be lost if
-// the code is regenerated.
-//
-// For more information, see: http://go.microsoft.com/fwlink/?LinkID=623246
-//
-//-----------------------------------------------------------------------------
-#include "pch.h"
-
-using namespace concurrency;
-using namespace Microsoft::WRL;
-using namespace Platform;
-using namespace Windows::Foundation;
-using namespace Windows::Devices::AllJoyn;
-using namespace org::alljoyn::Onboarding;
-
-std::map OnboardingConsumer::SourceInterfaces;
-PCSTR OnboardingConsumer::m_interfaceName = "org.alljoyn.Onboarding";
-
-OnboardingConsumer::OnboardingConsumer(AllJoynBusAttachment^ busAttachment)
- : m_busAttachment(busAttachment),
- m_proxyBusObject(nullptr),
- m_busObject(nullptr)
-{
- m_weak = new WeakReference(this);
- m_signals = ref new OnboardingSignals();
- m_nativeBusAttachment = AllJoynHelpers::GetInternalBusAttachment(m_busAttachment);
-
- GUID result;
- HRESULT hr = CoCreateGuid(&result);
-
- if (FAILED(hr))
- {
- throw ref new Exception(hr);
- }
-
- // The consumer needs a bus object to share signals, and its object path must be unique in
- // case multiple consumers are created using the same bus attachment.
- Guid gd(result);
- ServiceObjectPath = gd.ToString();
-}
-
-OnboardingConsumer::~OnboardingConsumer()
-{
- if (nullptr != ProxyBusObject)
- {
- alljoyn_proxybusobject_destroy(ProxyBusObject);
- }
- delete m_weak;
-}
-
-QStatus OnboardingConsumer::AddSignalHandler(_In_ alljoyn_busattachment busAttachment, _In_ alljoyn_interfacedescription interfaceDescription, _In_ PCSTR methodName, _In_ alljoyn_messagereceiver_signalhandler_ptr handler)
-{
- alljoyn_interfacedescription_member member;
- if (!alljoyn_interfacedescription_getmember(interfaceDescription, methodName, &member))
- {
- return ER_BUS_INTERFACE_NO_SUCH_MEMBER;
- }
-
- return alljoyn_busattachment_registersignalhandler(busAttachment, handler, member, NULL);
-}
-
-IAsyncOperation^ OnboardingConsumer::FromIdAsync(_In_ Platform::String^ deviceId)
-{
- return OnboardingConsumer::FromIdAsync(deviceId, AllJoynBusAttachment::GetDefault());
-}
-
-IAsyncOperation^ OnboardingConsumer::FromIdAsync(_In_ Platform::String^ deviceId, _In_ AllJoynBusAttachment^ busAttachment)
-{
- return create_async([deviceId, busAttachment]() -> OnboardingConsumer^
- {
- OnboardingConsumer^ result;
- create_task(AllJoynServiceInfo::FromIdAsync(deviceId)).then([busAttachment, &result](AllJoynServiceInfo^ serviceInfo)
- {
- if (serviceInfo != nullptr)
- {
- int32 status = AllJoynStatus::Ok;
- if (busAttachment->State == AllJoynBusAttachmentState::Disconnected)
- {
- event connectedEvent;
- auto token = busAttachment->StateChanged += ref new TypedEventHandler([&connectedEvent](AllJoynBusAttachment^, AllJoynBusAttachmentStateChangedEventArgs^ arg)
- {
- if (arg->State == AllJoynBusAttachmentState::Connected)
- {
- connectedEvent.set();
- }
- });
-
- status = AllJoynHelpers::CreateInterfaces(busAttachment, c_OnboardingIntrospectionXml);
- if (status == AllJoynStatus::Ok)
- {
- busAttachment->Connect();
- connectedEvent.wait();
- }
- busAttachment->StateChanged -= token;
- }
-
- if (status == AllJoynStatus::Ok)
- {
- auto consumer = ref new OnboardingConsumer(busAttachment);
- status = consumer->Initialize(serviceInfo);
- if (status == AllJoynStatus::Ok)
- {
- result = consumer;
- }
- }
- }
- }).wait();
-
- return result;
- });
-}
-
-IAsyncOperation^ OnboardingConsumer::ConfigureWiFiAsync(_In_ Platform::String^ interfaceMemberSSID, _In_ Platform::String^ interfaceMemberPassphrase, _In_ int16 interfaceMemberAuthType)
-{
- return create_async([this, interfaceMemberSSID, interfaceMemberPassphrase, interfaceMemberAuthType]() -> OnboardingConfigureWiFiResult^
- {
- auto result = ref new OnboardingConfigureWiFiResult();
-
- alljoyn_message message = alljoyn_message_create(m_nativeBusAttachment);
- size_t argCount = 3;
- alljoyn_msgarg inputs = alljoyn_msgarg_array_create(argCount);
-
- QStatus status = ER_OK;
- status = static_cast(TypeConversionHelpers::SetAllJoynMessageArg(alljoyn_msgarg_array_element(inputs, 0), "s", interfaceMemberSSID));
- if (ER_OK == status)
- {
- status = static_cast(TypeConversionHelpers::SetAllJoynMessageArg(alljoyn_msgarg_array_element(inputs, 1), "s", interfaceMemberPassphrase));
- }
- if (ER_OK == status)
- {
- status = static_cast(TypeConversionHelpers::SetAllJoynMessageArg(alljoyn_msgarg_array_element(inputs, 2), "n", interfaceMemberAuthType));
- }
- if (ER_OK == status)
- {
- status = alljoyn_proxybusobject_methodcall(
- ProxyBusObject,
- m_interfaceName,
- "ConfigureWiFi",
- inputs,
- argCount,
- message,
- c_MessageTimeoutInMilliseconds,
- 0);
- }
- result->Status = static_cast