using System; using System.ServiceModel; using System.ServiceModel.Web; using System.Collections.Generic; using CMS_CORE.Demo.Models; using CMS_CORE_Library.Demo.Models; namespace Nc_Demo_Application.Server.Service { [ServiceContract] interface ILibraryService { [OperationContract] #region Nc Data API [WebGet(UriTemplate = "cn/name/", BodyStyle = WebMessageBodyStyle.Wrapped, ResponseFormat = WebMessageFormat.Json)] void GetName(out string name); [WebGet(UriTemplate = "cn/language/", BodyStyle = WebMessageBodyStyle.Wrapped, ResponseFormat = WebMessageFormat.Json)] void GetLanguage(out string language); [WebGet(UriTemplate = "cn/serial_number/", BodyStyle = WebMessageBodyStyle.Wrapped, ResponseFormat = WebMessageFormat.Json)] void GetSerialNumber(out string serialNumber); [WebGet(UriTemplate = "cn/software_version/", BodyStyle = WebMessageBodyStyle.Wrapped, ResponseFormat = WebMessageFormat.Json)] void GetSoftwareVersion(out string softwareVersion); [WebGet(UriTemplate = "cn/model/", BodyStyle = WebMessageBodyStyle.Wrapped, ResponseFormat = WebMessageFormat.Json)] void GetModel(out string model); [WebGet(UriTemplate = "cn/date_time/", BodyStyle = WebMessageBodyStyle.Wrapped, ResponseFormat = WebMessageFormat.Json)] void GetDateTime(out string dateTime); [WebGet(UriTemplate = "cn/machine_number/", BodyStyle = WebMessageBodyStyle.Wrapped, ResponseFormat = WebMessageFormat.Json)] void GetMachineNumber(out string machineNumber); [WebGet(UriTemplate = "cn/process_number/", BodyStyle = WebMessageBodyStyle.Wrapped, ResponseFormat = WebMessageFormat.Json)] void GetProcessNumber(out ushort processNumber); #endregion #region Process API [WebGet(UriTemplate = "process/{id}/status/", BodyStyle = WebMessageBodyStyle.Wrapped, ResponseFormat = WebMessageFormat.Json)] void GetProcessStatus(string id, out int status); [WebGet(UriTemplate = "process/{id}/mode/", BodyStyle = WebMessageBodyStyle.Wrapped, ResponseFormat = WebMessageFormat.Json)] void GetProcessMode(string id, out int mode); [WebGet(UriTemplate = "process/{id}/alarms/", BodyStyle = WebMessageBodyStyle.Wrapped, ResponseFormat = WebMessageFormat.Json)] void GetProcessAlarms(string id, out List alarms); [WebGet(UriTemplate = "processes/alarms/", BodyStyle = WebMessageBodyStyle.Wrapped, ResponseFormat = WebMessageFormat.Json)] void GetProcessesAlarms(out List alarms); #endregion #region Process Axes API [WebGet(UriTemplate = "process/{id}/axes/", BodyStyle = WebMessageBodyStyle.Wrapped, ResponseFormat = WebMessageFormat.Json)] void GetAxesPosition(string id, out List axes); #endregion #region Binary Memory [WebGet(UriTemplate = "binary_memory/byte/{index}/{bit}", BodyStyle = WebMessageBodyStyle.Wrapped, ResponseFormat = WebMessageFormat.Json)] void GetBoolean(string index, string bit, out bool value); [WebGet(UriTemplate = "binary_memory/byte/{index}", BodyStyle = WebMessageBodyStyle.Wrapped, ResponseFormat = WebMessageFormat.Json)] void GetByte(string index, out byte value); [WebGet(UriTemplate = "binary_memory/word/{index}", BodyStyle = WebMessageBodyStyle.Wrapped, ResponseFormat = WebMessageFormat.Json)] void GetWord(string index, out ushort value); [WebGet(UriTemplate = "binary_memory/short/{index}", BodyStyle = WebMessageBodyStyle.Wrapped, ResponseFormat = WebMessageFormat.Json)] void GetShort(string index, out short value); [WebGet(UriTemplate = "binary_memory/dword/{index}", BodyStyle = WebMessageBodyStyle.Wrapped, ResponseFormat = WebMessageFormat.Json)] void GetDWord(string index, out uint value); [WebGet(UriTemplate = "binary_memory/integer/{index}", BodyStyle = WebMessageBodyStyle.Wrapped, ResponseFormat = WebMessageFormat.Json)] void GetInteger(string index, out int value); [WebInvoke(Method = "PUT", UriTemplate = "binary_memory/byte/{index}", RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)] void PutByte(string index, BinaryMemoryModel body); [WebInvoke(Method = "PUT", UriTemplate = "binary_memory/word/{index}", RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.WrappedRequest)] void PutWord(string index, BinaryMemoryModel body); [WebInvoke(Method = "PUT", UriTemplate = "binary_memory/short/{index}", RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.WrappedRequest)] void PutShort(string index, BinaryMemoryModel body); [WebInvoke(Method = "PUT", UriTemplate = "binary_memory/integer/{index}", RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.WrappedRequest)] void PutInteger(string index, BinaryMemoryModel body); [WebInvoke(Method = "PUT", UriTemplate = "binary_memory/dword/{index}", RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.WrappedRequest)] void PutDWord(string index, BinaryMemoryModel body); #endregion #region Binary Memory List [WebGet(UriTemplate = "binary_memory/byte/{index}/list/{number}", BodyStyle = WebMessageBodyStyle.Wrapped, ResponseFormat = WebMessageFormat.Json)] void GetByteList(string index, string number, out List byteList); [WebGet(UriTemplate = "binary_memory/word/{index}/list/{number}", BodyStyle = WebMessageBodyStyle.Wrapped, ResponseFormat = WebMessageFormat.Json)] void GetWordList(string index, string number, out List byteList); [WebGet(UriTemplate = "binary_memory/short/{index}/list/{number}", BodyStyle = WebMessageBodyStyle.Wrapped, ResponseFormat = WebMessageFormat.Json)] void GetShortList(string index, string number, out List byteList); [WebGet(UriTemplate = "binary_memory/integer/{index}/list/{number}", BodyStyle = WebMessageBodyStyle.Wrapped, ResponseFormat = WebMessageFormat.Json)] void GetIntegerList(string index, string number, out List byteList); [WebGet(UriTemplate = "binary_memory//{index}/list/{number}", BodyStyle = WebMessageBodyStyle.Wrapped, ResponseFormat = WebMessageFormat.Json)] void GetDWordList(string index, string number, out List byteList); [WebInvoke(Method = "PUT", UriTemplate = "binary_memory/byte/{index}/list", RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.WrappedRequest)] void PutByteList(string index, BinaryMemoryModel body); [WebInvoke(Method = "PUT", UriTemplate = "binary_memory/word/{index}/list", RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.WrappedRequest)] void PutWordList(string index, BinaryMemoryModel body); [WebInvoke(Method = "PUT", UriTemplate = "binary_memory/short/{index}/list", RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.WrappedRequest)] void PutShortList(string index, BinaryMemoryModel body); [WebInvoke(Method = "PUT", UriTemplate = "binary_memory/integer/{index}/list", RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.WrappedRequest)] void PutIntegerList(string index, BinaryMemoryModel body); [WebInvoke(Method = "PUT", UriTemplate = "binary_memory/dword/{index}/list", RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.WrappedRequest)] void PutDWordList(string index, BinaryMemoryModel body); #endregion #region File Management [WebGet(UriTemplate = "file/{fileName}", BodyStyle = WebMessageBodyStyle.Wrapped, ResponseFormat = WebMessageFormat.Json)] void GetFile(string fileName, out string fileContent); [WebInvoke(Method = "POST", UriTemplate = "file", RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.Wrapped)] void PostFile(FileModel file); [WebInvoke(Method = "PUT", UriTemplate = "file", RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.Wrapped)] void CopyFile(FileModel file); [WebInvoke(Method = "DELETE", UriTemplate = "file/{fileName}", RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.Wrapped)] void DeleteFile(string fileName); #endregion } }