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
85
86
87
88
89
90
91
92
using System.ServiceModel;
using System.ServiceModel.Web;
using System.IO;
using System.Runtime.Serialization;
using System.Collections.Generic;
using DeviceLibrary.service.model;
namespace DeviceLibrary
{
[ServiceContract(Name = "Service")]
internal interface IService
{
[OperationContract]
[WebInvoke(UriTemplate = "/missions/create", Method = "POST", BodyStyle = WebMessageBodyStyle.Bare, RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
Result Create(Stream stream);
[OperationContract]
[WebInvoke(UriTemplate = "/missions/update", Method = "POST", BodyStyle = WebMessageBodyStyle.Bare, RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
Result Update(Stream stream);
[OperationContract]
[WebInvoke(UriTemplate = "/missions/delete", Method = "POST", BodyStyle = WebMessageBodyStyle.Bare, RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
Result Delete(Stream stream);
[OperationContract]
[WebInvoke(UriTemplate = "/missions/readAll", Method = "GET", BodyStyle = WebMessageBodyStyle.Bare, RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
MissionResult ReadAll();
[OperationContract]
[WebInvoke(UriTemplate = "/missions/operationFinish", Method = "POST", BodyStyle = WebMessageBodyStyle.Bare, RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
Result OperationFinish(Stream stream);
[OperationContract]
[WebInvoke(UriTemplate = "/StealAgv/storage?Place={Place}", Method = "GET", BodyStyle = WebMessageBodyStyle.Bare, RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
StealResult Storage(string Place);
[OperationContract]
[WebInvoke(UriTemplate = "/StealAgv/sendNew?From={From}&Place={Place}", Method = "GET", BodyStyle = WebMessageBodyStyle.Bare, RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
StealResult SendNew(string From, string Place);
[OperationContract]
[WebInvoke(UriTemplate = "/position/state?name={name}", Method = "GET", BodyStyle = WebMessageBodyStyle.Bare, RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
Result GetPositionState(string name);
}
[DataContract]
public class Result
{
/// <summary>
/// 状态码,0为正常
/// </summary>
[DataMember]
public int code { get; set; } = 0;
/// <summary>
/// 返回数据
/// </summary>
[DataMember]
public string data { get; set; } = "";
/// <summary>
/// 提示信息
/// </summary>
[DataMember]
public string msg { get; set; } = "ok";
}
[DataContract]
internal class StealResult
{
[DataMember]
public string Msg { get; set; }
}
[DataContract]
internal class MissionResult
{
/// <summary>
/// 状态码,0为正常
/// </summary>
[DataMember]
public int code { get; set; } = 0;
/// <summary>
/// 返回数据
/// </summary>
[DataMember]
public List<MissionInfo> data { get; set; }
/// <summary>
/// 提示信息
/// </summary>
[DataMember]
public string msg { get; set; } = "ok";
}
}