IService.cs
3.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
using System.IO;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.ServiceModel.Web;
using System.Threading.Tasks;
namespace DeviceLibrary.Service
{
[ServiceContract(Name = "LiftServices")]
internal interface IService
{
//[OperationContract]
//[WebInvoke(UriTemplate = "call?target={target}&type={type}&id={id}", Method = "GET", BodyStyle = WebMessageBodyStyle.Bare, RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
//Result CallByGet(string target, int type, string id);
[OperationContract]
[WebInvoke(UriTemplate = "/lift/sendIn", Method = "POST", BodyStyle = WebMessageBodyStyle.Bare, RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
Result sendIn(Stream stream);
//[OperationContract]
//[WebInvoke(UriTemplate = "/lift/closeDoor", Method = "POST", BodyStyle = WebMessageBodyStyle.Bare, RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
//Result closeDoor(Stream stream);
//[OperationContract]
//[WebInvoke(UriTemplate = "/lift/openDoor", Method = "POST", BodyStyle = WebMessageBodyStyle.Bare, RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
//Result openDoor(Stream stream);
[OperationContract]
[WebInvoke(UriTemplate = "/lift/call", Method = "POST", BodyStyle = WebMessageBodyStyle.Bare, RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
Result Call(Stream stream);
[OperationContract]
[WebInvoke(UriTemplate = "/lift/leave", Method = "POST", BodyStyle = WebMessageBodyStyle.Bare, RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
Result Leave(Stream stream);
[OperationContract]
[WebInvoke(UriTemplate = "/lift/status", Method = "POST", BodyStyle = WebMessageBodyStyle.Bare, RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
StatusResult status(Stream stream);
[OperationContract]
[WebInvoke(UriTemplate = "/lift/finishedProdcut", Method = "POST", BodyStyle = WebMessageBodyStyle.Bare, RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
Result finishedProdcut(Stream stream);
}
[DataContract]
internal class Result
{
/// <summary>
/// 状态码。0为正常。其他为异常。
/// </summary>
[DataMember]
public int code { get; set; } = 0;
/// <summary>
/// 提示消息
/// </summary>
[DataMember]
public string msg { get; set; } = "ok";
/// <summary>
/// 返回数据
/// </summary>
[DataMember]
public string data { get; set; } = "";
}
[DataContract]
internal class StatusResult
{
/// <summary>
/// 状态码。0为正常。其他为异常。
/// </summary>
[DataMember]
public int code { get; set; } = 0;
/// <summary>
/// 提示消息
/// </summary>
[DataMember]
public string msg { get; set; } = "ok";
/// <summary>
/// 返回数据
/// </summary>
[DataMember]
public Models.Service.Response.Status data { get; set; }
public StatusResult()
{
data = new Models.Service.Response.Status();
}
}
}