ExampleGenerator.CreateExamples.ConnectDevice C# (CSharp) Méthode

ConnectDevice() static private méthode

Add a second device
static private ConnectDevice ( ) : void
Résultat void
        void ConnectDevice() {
            
            // Create device profile
            SignedDeviceProfile2 = new SignedDeviceProfile(Device2, Device2Description);

            Portal.Label(LabelConnectRequest);
            // Post connection request
            var ConnectRequestResult = MeshClient.ConnectRequest (SignedDeviceProfile2);

            Portal.Label(LabelConnectPending);
            // Poll for list of connection requests
            var ConnectPendingResult = MeshClient.ConnectPending();


            var FirstRequest = ConnectPendingResult.Pending[0];

            // Publish the updated profile to the Mesh.
            Portal.Label(LabelConnectPublish);
            PersonalProfile.Add(FirstRequest.Data.Device);
            SignedPersonalProfile = PersonalProfile.Signed;
            MeshClient.Publish(SignedPersonalProfile);

            Portal.Label(LabelConnectAccept);
            // Post acceptance for first request
            var ConnectCloseResult = MeshClient.ConnectClose(FirstRequest, 
                                    ConnectionStatus.Accepted);
            Portal.Label(LabelConnectStatus);
            // Retrieve acceptance
            var Status = MeshClient.ConnectStatus(SignedDeviceProfile2.UDF);
            }