diff --git a/src/core/src/AXOpen.Core.Blazor/AxoMessenger/Static/AxoMessageObserver.cs b/src/core/src/AXOpen.Core.Blazor/AxoMessenger/Static/AxoMessageObserver.cs
index d72e16179..217b89901 100644
--- a/src/core/src/AXOpen.Core.Blazor/AxoMessenger/Static/AxoMessageObserver.cs
+++ b/src/core/src/AXOpen.Core.Blazor/AxoMessenger/Static/AxoMessageObserver.cs
@@ -125,5 +125,11 @@ await Task.Run(() => {
}
});
}
-
+
+ public static async Task
CreateAndInitialize(AxoMessageProvider provider, RenderableComponentBase unitBaseSpotView)
+ {
+ var observer = AxoMessageObserver.Create(provider, unitBaseSpotView);
+ await observer.InitializeUpdate();
+ return observer;
+ }
}
\ No newline at end of file
diff --git a/src/core/src/AXOpen.Core.Blazor/AxoObject/AxoObjectDiagnosticsView.razor b/src/core/src/AXOpen.Core.Blazor/AxoObject/AxoObjectDiagnosticsView.razor
index 7eb869073..7fb29a167 100644
--- a/src/core/src/AXOpen.Core.Blazor/AxoObject/AxoObjectDiagnosticsView.razor
+++ b/src/core/src/AXOpen.Core.Blazor/AxoObject/AxoObjectDiagnosticsView.razor
@@ -133,7 +133,7 @@
var ast = await AuthenticationStateProvider.GetAuthenticationStateAsync();
if (Observer?.Provider is {Messengers: not null })
{
- foreach (var messenger in Observer.Provider.Messengers)
+ foreach (var messenger in Observer.Provider.Messengers.Where(p =>p.State == eAxoMessengerState.NotActiveWaitingAckn))
{
messenger.Acknowledge(ast.User.Identity);
}
diff --git a/src/data/app/ix-blazor/librarytemplate.blazor/Program.cs b/src/data/app/ix-blazor/librarytemplate.blazor/Program.cs
index 1e258111a..1db52f8d1 100644
--- a/src/data/app/ix-blazor/librarytemplate.blazor/Program.cs
+++ b/src/data/app/ix-blazor/librarytemplate.blazor/Program.cs
@@ -17,6 +17,7 @@
using AXOpen.Data.MongoDb;
using AXOpen.Data.Json;
+
var builder = WebApplication.CreateBuilder(args);
var jsonRepositoryLocation = CreateJsonRepositoryDirectory();
@@ -58,11 +59,9 @@
//persistentRepository = new JsonRepositorySettings(persistentLocation).Factory();
// *** MONGO REPOSITORY ***
-AXOpen.Data.MongoDb.Repository.InitializeFactory(mongoConnectionString: "mongodb://localhost:27017",
- mongoDatabaseName: "AxOpenData",
- user: "user",
- userpw: "userpwd");
-persistentRepository = AXOpen.Data.MongoDb.Repository.Factory("PersistentData");
+
+
+persistentRepository = AXOpen.Data.MongoDb.Repository.Factory(new MongoDbRepositorySettings("mongodb://localhost:27017", "AxOpenData", "PersistentData"));
Entry.Plc.AxoDataPersistentContext.DataManager.InitializeRemoteDataExchange(
@@ -87,12 +86,9 @@
//Station_1_DataRepository = new JsonRepositorySettings(Station_1_Location).Factory();
// *** MONGO REPOSITORY ***
-AXOpen.Data.MongoDb.Repository.InitializeFactory(mongoConnectionString: "mongodb://localhost:27017",
- mongoDatabaseName: "AxOpenData",
- user: "user",
- userpw: "userpwd");
-SharedDataHeaderDataRepository = AXOpen.Data.MongoDb.Repository.Factory("SharedDataHeader");
-Station_1_DataRepository = AXOpen.Data.MongoDb.Repository.Factory("Station_1");
+
+SharedDataHeaderDataRepository = AXOpen.Data.MongoDb.Repository.Factory(new MongoDbRepositorySettings("mongodb://localhost:27017", "AxOpenData", "SharedDataHeader"));
+Station_1_DataRepository = AXOpen.Data.MongoDb.Repository.Factory(new MongoDbRepositorySettings("mongodb://localhost:27017", "AxOpenData", "Station_1"));
var AxoProcessDataManager = Entry.Plc.AxoDataFragmentsExchangeContext.DataManager.CreateBuilder();
@@ -114,11 +110,9 @@
//AxoProcessDataRepository = new JsonRepositorySettings(ProcessDataLocation).Factory();
// *** MONGO REPOSITORY ***
-AXOpen.Data.MongoDb.Repository.InitializeFactory(mongoConnectionString: "mongodb://localhost:27017",
- mongoDatabaseName: "AxOpenData",
- user: "user",
- userpw: "userpwd");
-AxoProcessDataRepository = AXOpen.Data.MongoDb.Repository.Factory("AxoDataExchangeExample");
+
+
+AxoProcessDataRepository = AXOpen.Data.MongoDb.Repository.Factory(new MongoDbRepositorySettings("mongodb://localhost:27017", "AxOpenData","AxoDataExchangeExample"));
Entry.Plc.AxoDataExchangeContext.DataManager.InitializeRemoteDataExchange(AxoProcessDataRepository);
//
diff --git a/src/data/src/repositories/MongoDb/Mongo/MongoDbRepositorySettings.cs b/src/data/src/repositories/MongoDb/Mongo/MongoDbRepositorySettings.cs
index 8a76c417b..7a03be52b 100644
--- a/src/data/src/repositories/MongoDb/Mongo/MongoDbRepositorySettings.cs
+++ b/src/data/src/repositories/MongoDb/Mongo/MongoDbRepositorySettings.cs
@@ -39,6 +39,21 @@ public MongoDbRepositorySettings(string connectionString, string databaseName, s
}
+ ///
+ /// Creates new instance of for a with NON-SECURED access.
+ ///
+ /// Database connection string
+ /// Database name
+ /// Collection name
+ /// Id expression
+ public MongoDbRepositorySettings(string connectionString, string databaseName, string collectionName, Expression> idExpression)
+ {
+ SetupSerialisationAndMapping(idExpression);
+ Client = GetClient(connectionString);
+ Database = GetDatabase(databaseName);
+ Collection = GetCollection(collectionName);
+ }
+
///
/// Creates new instance of for a with secured access.
///
@@ -55,6 +70,7 @@ public MongoDbRepositorySettings(string connectionString, string databaseName, s
Collection = GetCollection(collectionName);
}
+
///
/// Initializes a new instance of the class for a
/// with secured access. This constructor sets up the MongoDB
diff --git a/src/data/src/repositories/MongoDb/RepositoryExtensions.cs b/src/data/src/repositories/MongoDb/RepositoryExtensions.cs
index 75c198bc7..a9a284596 100644
--- a/src/data/src/repositories/MongoDb/RepositoryExtensions.cs
+++ b/src/data/src/repositories/MongoDb/RepositoryExtensions.cs
@@ -7,26 +7,26 @@ namespace AXOpen.Data.MongoDb
{
public static class Repository
{
- private static string MongoConnectionString { get; set; }
- private static string MongoDatabaseName { get; set; }
- private static MongoDbCredentials Credentials { get; set; }
+ //private static string MongoConnectionString { get; set; }
+ //private static string MongoDatabaseName { get; set; }
+ //private static MongoDbCredentials Credentials { get; set; }
- ///
- /// Initializes the MongoDB repository factory with default connection settings.
- ///
- /// The MongoDB connection string.
- /// The name of the MongoDB database.
- /// The username for database access.
- /// The password for database access.
- public static void InitializeFactory(string mongoConnectionString = "mongodb://localhost:27017",
- string mongoDatabaseName = "AxOpenData",
- string user = "user",
- string userpw = "userpwd")
- {
- MongoConnectionString = mongoConnectionString;
- MongoDatabaseName = mongoDatabaseName;
- Credentials = new MongoDbCredentials(MongoDatabaseName, user, userpw);
- }
+ /////
+ ///// Initializes the MongoDB repository factory with default connection settings.
+ /////
+ ///// The MongoDB connection string.
+ ///// The name of the MongoDB database.
+ ///// The username for database access.
+ ///// The password for database access.
+ //public static void InitializeFactory(string mongoConnectionString = "mongodb://localhost:27017",
+ // string mongoDatabaseName = "AxOpenData",
+ // string user = "user",
+ // string userpw = "userpwd")
+ //{
+ // MongoConnectionString = mongoConnectionString;
+ // MongoDatabaseName = mongoDatabaseName;
+ // Credentials = new MongoDbCredentials(MongoDatabaseName, user, userpw);
+ //}
///
/// Creates a repository for a specific type using the provided repository settings.
@@ -47,57 +47,57 @@ public static IRepository Factory(this MongoDbRepositorySettings parame
}
}
- ///
- /// Creates a repository for a specific type and collection name.
- ///
- /// The type of the data object for the repository.
- /// The name of the MongoDB collection.
- /// An instance of .
- /// Thrown when repository creation fails.
- public static IRepository Factory(string collectionName) where T : IBrowsableDataObject
- {
- try
- {
- var settings = new MongoDbRepositorySettings(
- connectionString: MongoConnectionString,
- databaseName: MongoDatabaseName,
- collectionName: collectionName,
- credentials: Credentials);
+ /////
+ ///// Creates a repository for a specific type and collection name.
+ /////
+ ///// The type of the data object for the repository.
+ ///// The name of the MongoDB collection.
+ ///// An instance of .
+ ///// Thrown when repository creation fails.
+ //public static IRepository Factory(string collectionName) where T : IBrowsableDataObject
+ //{
+ // try
+ // {
+ // var settings = new MongoDbRepositorySettings(
+ // connectionString: MongoConnectionString,
+ // databaseName: MongoDatabaseName,
+ // collectionName: collectionName,
+ // credentials: Credentials);
- return new MongoDbRepository(settings);
- }
- catch (Exception ex)
- {
- throw new Exception($"Creation of MongoDb repository failed. Check number, type and value of parameters. For detail see inner exception.", ex);
- }
- }
+ // return new MongoDbRepository(settings);
+ // }
+ // catch (Exception ex)
+ // {
+ // throw new Exception($"Creation of MongoDb repository failed. Check number, type and value of parameters. For detail see inner exception.", ex);
+ // }
+ //}
- ///
- /// Creates a repository for a specific type, collection name, and ID expression.
- ///
- /// The type of the data object for the repository.
- /// The name of the MongoDB collection.
- /// An expression defining the property to use as the MongoDB '_id'.
- /// An instance of .
- /// Thrown when repository creation fails.
- public static IRepository Factory(string collectionName,Expression> idExpression) where T : IBrowsableDataObject
- {
- try
- {
- var settings = new MongoDbRepositorySettings(
- connectionString: MongoConnectionString,
- databaseName: MongoDatabaseName,
- collectionName: collectionName,
- credentials: Credentials,
- idExpression : idExpression
- );
+ /////
+ ///// Creates a repository for a specific type, collection name, and ID expression.
+ /////
+ ///// The type of the data object for the repository.
+ ///// The name of the MongoDB collection.
+ ///// An expression defining the property to use as the MongoDB '_id'.
+ ///// An instance of .
+ ///// Thrown when repository creation fails.
+ //public static IRepository Factory(MongoDbRepositorySettings settings, Expression> idExpression) where T : IBrowsableDataObject
+ //{
+ // try
+ // {
+ // var settings = new MongoDbRepositorySettings(
+ // connectionString: MongoConnectionString,
+ // databaseName: MongoDatabaseName,
+ // collectionName: collectionName,
+ // credentials: Credentials,
+ // idExpression: idExpression
+ // );
- return new MongoDbRepository(settings);
- }
- catch (Exception ex)
- {
- throw new Exception($"Creation of MongoDb repository failed. Check number, type and value of parameters. For detail see inner exception.", ex);
- }
- }
+ // return new MongoDbRepository(settings);
+ // }
+ // catch (Exception ex)
+ // {
+ // throw new Exception($"Creation of MongoDb repository failed. Check number, type and value of parameters. For detail see inner exception.", ex);
+ // }
+ //}
}
}
diff --git a/src/data/this.sln b/src/data/this.sln
index 364e58f24..d9659560c 100644
--- a/src/data/this.sln
+++ b/src/data/this.sln
@@ -41,9 +41,9 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "axopen_repository_integrati
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ix_ax_ax_sdk", "..\sdk-ax\ctrl\ix\ix_ax_ax_sdk.csproj", "{5DA36EFB-55C4-4386-AD4C-99AC7783E12E}"
EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AXOpen.Security.Blazor", "..\Security\src\AXOpen.Security.Blazor\AXOpen.Security.Blazor.csproj", "{52AC8CD2-AA13-42FD-AFA7-F53C213D4731}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AXOpen.Security.Blazor", "..\security\src\AXOpen.Security.Blazor\AXOpen.Security.Blazor.csproj", "{52AC8CD2-AA13-42FD-AFA7-F53C213D4731}"
EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AXOpen.Security", "..\Security\src\AXOpen.Security\AXOpen.Security.csproj", "{60C84F3C-1ECC-4553-975B-02DB599A083C}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AXOpen.Security", "..\security\src\AXOpen.Security\AXOpen.Security.csproj", "{60C84F3C-1ECC-4553-975B-02DB599A083C}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ix_ax_axopen_simatic1500", "..\simatic1500\ctrl\ix\ix_ax_axopen_simatic1500.csproj", "{74C7FC26-1CFB-45AF-BF08-296531C7AFAD}"
EndProject
@@ -123,13 +123,13 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ctrl", "..\sdk-ax\ctrl", "{
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "sdk-ax", "..\sdk-ax", "{EC2CC8A1-A290-4331-8418-01B4589134A7}"
EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "AXOpen.Security.Blazor", "..\Security\src\AXOpen.Security.Blazor", "{747FF901-E6DE-424A-B72A-19CD5DB2EC35}"
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "AXOpen.Security.Blazor", "..\security\src\AXOpen.Security.Blazor", "{747FF901-E6DE-424A-B72A-19CD5DB2EC35}"
EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "AXOpen.Security", "..\Security\src\AXOpen.Security", "{155C38C3-B5F1-4B8C-9CEE-A0E480050212}"
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "AXOpen.Security", "..\security\src\AXOpen.Security", "{155C38C3-B5F1-4B8C-9CEE-A0E480050212}"
EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "..\Security\src", "{D0B64D79-991E-40A9-8124-4EE6A520F0C8}"
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "..\security\src", "{D0B64D79-991E-40A9-8124-4EE6A520F0C8}"
EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Security", "..\Security", "{C15F8A3D-3A08-46A6-8C5B-2E0532ECE434}"
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "security", "..\security", "{C15F8A3D-3A08-46A6-8C5B-2E0532ECE434}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ix", "..\simatic1500\ctrl\ix", "{6FF72005-D3B5-4BD6-8412-E13F37F67D54}"
EndProject
diff --git a/src/templates.simple/ax/src/BaseUnit/Unit.st b/src/templates.simple/ax/src/BaseUnit/Unit.st
index 28ce26190..5783d027e 100644
--- a/src/templates.simple/ax/src/BaseUnit/Unit.st
+++ b/src/templates.simple/ax/src/BaseUnit/Unit.st
@@ -8,7 +8,7 @@ NAMESPACE axosimple.BaseUnit
/// Represents controlled units and high level task coordination.
///
{S7.extern=ReadWrite}
- CLASS PUBLIC Unit
+ CLASS PUBLIC UnitBase
EXTENDS AXOpen.Core.AxoObject IMPLEMENTS axosimple.IUnit
VAR PUBLIC
diff --git a/src/templates.simple/ax/src/templates/starterunit/Comonents.st b/src/templates.simple/ax/src/templates/starterunit/Comonents.st
index 088080af0..1368867a2 100644
--- a/src/templates.simple/ax/src/templates/starterunit/Comonents.st
+++ b/src/templates.simple/ax/src/templates/starterunit/Comonents.st
@@ -12,11 +12,11 @@ NAMESPACE axosimple.StarterUnitTemplate
EXTENDS AXOpen.Core.AxoObject
VAR PUBLIC
// HERE DECLARE COMPONENTS USED BY THIS CONTROLLED UNIT
- // HorizontalCylinder : AXOpen.Components.Pneumatics.AxoCylinder;
- // VerticalCylinder : AXOpen.Components.Pneumatics.AxoCylinder;
- // GripperCylinder : AXOpen.Components.Pneumatics.AxoCylinder;
- // DMCReader : AXOpen.Components.Cognex.Vision.v_6_0_0_0.AxoDataman;
- // PartPresenceSensor : AXOpen.Elements.AxoDi;
+ HorizontalCylinder : AXOpen.Components.Pneumatics.AxoCylinder;
+ VerticalCylinder : AXOpen.Components.Pneumatics.AxoCylinder;
+ GripperCylinder : AXOpen.Components.Pneumatics.AxoCylinder;
+ DMCReader : AXOpen.Components.Cognex.Vision.v_6_0_0_0.AxoDataman;
+ PartPresenceSensor : AXOpen.Elements.AxoDi;
END_VAR
METHOD PUBLIC Update
@@ -29,9 +29,9 @@ NAMESPACE axosimple.StarterUnitTemplate
END_VAR
THIS.Initialize(parent);
// HERE INITIALIZE YOUR COMPONENTS
- // HorizontalCylinder.Run(THIS, Inputs.B0[0], Inputs.B0[1], Outputs.B0[0], Outputs.B0[1]);
- // VerticalCylinder.Run(THIS, Inputs.B0[2], Inputs.B0[3], Outputs.B0[2], Outputs.B0[3]);
- // GripperCylinder.Run(THIS, Inputs.B0[4], Inputs.B0[5], Outputs.B0[4], Outputs.B0[5]);
+ HorizontalCylinder.Run(THIS, Inputs.P0[0], Inputs.P0[1], Outputs.P0[0], Outputs.P0[1]);
+ VerticalCylinder.Run(THIS, Inputs.P0[2], Inputs.P0[3], Outputs.P0[2], Outputs.P0[3]);
+ GripperCylinder.Run(THIS, Inputs.P0[4], Inputs.P0[5], Outputs.P0[4], Outputs.P0[5]);
END_METHOD
END_CLASS
END_NAMESPACE
diff --git a/src/templates.simple/ax/src/templates/starterunit/GroundSequence.st b/src/templates.simple/ax/src/templates/starterunit/GroundSequence.st
index 2a9f43f69..7d84b8f74 100644
--- a/src/templates.simple/ax/src/templates/starterunit/GroundSequence.st
+++ b/src/templates.simple/ax/src/templates/starterunit/GroundSequence.st
@@ -54,6 +54,7 @@ NAMESPACE axosimple.StarterUnitTemplate
VAR
taskState : AXOpen.Core.IAxoTaskState;
forIterator : INT;
+ _dialogAnswer : eDialogAnswer;
END_VAR;
// IF (Components = NULL OR ProcessData = NULL) THEN
// RETURN;
@@ -64,9 +65,26 @@ NAMESPACE axosimple.StarterUnitTemplate
// This sets the sequence to run once (top-botton) and stops with done after closing.
THIS.SequenceMode := eAxoSequenceMode#RunOnce;
+ IF (Steps[0].Execute(THIS, TRUE, '<#DIALOG#>')) THEN
+ //-------------------------------------------------------
+
+ _dialogAnswer := Objs^._dialog.Show(THIS).WithCaption('<#DO YOU WANT TO RUN THE GROUND MODE SEQUENCE?#>').WithYesNo().WithType(eDialogType#Warning).Answer();
+
+ IF(_dialogAnswer <> eDialogAnswer#NoAnswer) THEN
+ IF(_dialogAnswer = eDialogAnswer#Yes) THEN
+ THIS.MoveNext();
+ END_IF;
+
+ IF(_dialogAnswer = eDialogAnswer#No) THEN
+ THIS.Restore();
+ END_IF;
+ END_IF;
+ //-------------------------------------------------------
+ END_IF;
+
// This is more verbose but also more versatile way of executing step logic.
- IF (Steps[0].Execute(THIS, TRUE, '<#RESTORE#>')) THEN
- //-------------------------------------------------------
+ IF (Steps[1].Execute(THIS, TRUE, '<#RESTORE#>')) THEN
+ //-------------------------------------------------------
TechnologySettingsManager^.Restore();
ProcessSettingsManager^.Restore();
ProcessDataManager^.Restore();
@@ -79,7 +97,8 @@ NAMESPACE axosimple.StarterUnitTemplate
//-------------------------------------------------------
END_IF;
- IF (Steps[1].Execute(THIS, TRUE, '<#READ PERSISTENT SETTINGS#>')) THEN
+
+ IF (Steps[2].Execute(THIS, TRUE, '<#READ PERSISTENT SETTINGS#>')) THEN
//-------------------------------------------------------
IF CurrentStep.IsFirstEntryToStep() THEN
;// some special initialization
diff --git a/src/templates.simple/ax/src/templates/starterunit/ServiceMode.st b/src/templates.simple/ax/src/templates/starterunit/ServiceMode.st
index 00100271e..24a835ca4 100644
--- a/src/templates.simple/ax/src/templates/starterunit/ServiceMode.st
+++ b/src/templates.simple/ax/src/templates/starterunit/ServiceMode.st
@@ -35,9 +35,9 @@ NAMESPACE axosimple.StarterUnitTemplate
END_VAR
;
// HERE CALL LOGIC FOR MANUAL/SERICE OPERATIONS
- // components.HorizontalCylinder.ActivateManualControl();
- // components.VerticalCylinder.ActivateManualControl();
- // components.GripperCylinder.ActivateManualControl();
+ components.HorizontalCylinder.ActivateManualControl();
+ components.VerticalCylinder.ActivateManualControl();
+ components.GripperCylinder.ActivateManualControl();
END_METHOD
END_CLASS
END_NAMESPACE
diff --git a/src/templates.simple/ax/src/templates/starterunit/Unit.st b/src/templates.simple/ax/src/templates/starterunit/Unit.st
index 26337fe6c..df2d9f030 100644
--- a/src/templates.simple/ax/src/templates/starterunit/Unit.st
+++ b/src/templates.simple/ax/src/templates/starterunit/Unit.st
@@ -9,7 +9,7 @@ NAMESPACE axosimple.StarterUnitTemplate
///
{S7.extern=ReadWrite}
CLASS Unit
- EXTENDS axosimple.BaseUnit.Unit
+ EXTENDS axosimple.BaseUnit.UnitBase
VAR PUBLIC
///
/// Provide access to unit objets, that are used into sequnces.
diff --git a/src/templates.simple/ax/src/templates/starterunit/server/StarterUnitTemplate.razor b/src/templates.simple/ax/src/templates/starterunit/server/StarterUnitTemplate.razor
index b5f34e2ae..87fd18f9d 100644
--- a/src/templates.simple/ax/src/templates/starterunit/server/StarterUnitTemplate.razor
+++ b/src/templates.simple/ax/src/templates/starterunit/server/StarterUnitTemplate.razor
@@ -1,10 +1,13 @@
-@page "/Context/Units/StarterUnitTemplate"
+@page "/Context/StarterUnitTemplate"
@using AXOpen.Base.Dialogs;
@using AXOpen.ToolBox.Extensions
-@using axosimple.server.Components;
@using AXOpen.VisualComposer;
@using AXSharp.Connector;
@using AXOpen.Core;
+@using axosimple.server.Units
+@using axosimple.StarterUnitTemplate
+@using Context = axosimple.Context
+@using Unit = axosimple.server.Components.Unit
@inject IAlertService _alerts
@inherits RenderableComplexComponentBase
@@ -38,18 +41,11 @@
+
@code
{
- private axosimple.UnitTemplate.Unit Unit => Entry.Plc.Context.UnitTemplate;
+ private UnitServices Services => Entry.Plc.Context.StarterUnitTemplate.Services;
+ private axosimple.StarterUnitTemplate.Unit Unit => Entry.Plc.Context.StarterUnitTemplate;
}
\ No newline at end of file
diff --git a/src/templates.simple/ax/src/templates/starterunit/twin/StarterUnitTemplate.cs b/src/templates.simple/ax/src/templates/starterunit/twin/StarterUnitTemplate.cs
index 17e6cf44c..3c0cb0d97 100644
--- a/src/templates.simple/ax/src/templates/starterunit/twin/StarterUnitTemplate.cs
+++ b/src/templates.simple/ax/src/templates/starterunit/twin/StarterUnitTemplate.cs
@@ -1,16 +1,66 @@
using AXOpen.Base.Data;
-using axosimple;
+using AXOpen.Data.MongoDb;
+using AXOpen.Messaging.Static;
+using axosimple.server.Units;
+using AXSharp.Connector;
-namespace axosimple.server.Units
+
+namespace axosimple.StarterUnitTemplate
{
- public class StarterUnitTemplateServices
+ public partial class Unit
+ {
+ public UnitServices Services { get; }
+ }
+
+ public class UnitServices : IUnitServices
{
- private StarterUnitTemplateServices(ContextService contextService)
+ private UnitServices(ContextService contextService)
{
_contextService = contextService;
}
+
+ public AXOpen.Data.AxoDataEntity? Data { get; } = Entry.Plc.Context.StarterUnitTemplateProcessData.DataManger.Payload;
+
+ public AXOpen.Data.AxoDataEntity? DataHeader { get; } = Entry.Plc.Context.StarterUnitTemplateProcessData.Shared.Entity;
+
+ public AXOpen.Data.AxoDataExchangeBase? DataManger { get; } = Entry.Plc.Context.StarterUnitTemplateProcessData;
+
+ public AXOpen.Data.AxoDataEntity? TechnologySettings { get; } =
+ Entry.Plc.Context.StarterUnitTemplateTechnologySettings.Shared.Entity;
- private StarterUnitTemplate.Unit Unit { get; } = Entry.Plc.Context.StarterUnitTemplate;
+ public AXOpen.Data.AxoDataEntity? SharedTechnologySettings { get; } =
+ Entry.Plc.Context.StarterUnitTemplateTechnologySettings.DataManger.Payload;
+
+ public AxoObject? UnitComponents => Entry.Plc.Context.StarterUnitTemplateComponents;
+
+ public ITwinObject[] Associates => new ITwinObject[]
+ {
+ SharedTechnologySettings,
+ TechnologySettings,
+ DataManger,
+ Data,
+ DataHeader,
+ UnitComponents,
+ Entry.Plc.Context.Safety.Zone_1,
+ Entry.Plc.Context.Safety.Zone_2
+ };
+
+ private AxoMessageProvider _messageProvider;
+
+ public AxoMessageProvider MessageProvider
+ {
+ get
+ {
+ if (_messageProvider == null)
+ {
+ _messageProvider = AxoMessageProvider.Create(Associates);
+ }
+
+ return _messageProvider;
+ }
+ }
+
+ public axosimple.BaseUnit.UnitBase Unit { get; } = Entry.Plc.Context.StarterUnitTemplate;
// Technology Data manager of unit
private StarterUnitTemplate.TechnologyDataManager StarterUnitTechnologyDataManager { get; } =
@@ -25,35 +75,64 @@ private StarterUnitTemplateServices(ContextService contextService)
///