Skip to content

Commit bc9943e

Browse files
committed
undo rename
1 parent aae8b62 commit bc9943e

6 files changed

Lines changed: 20 additions & 20 deletions

File tree

src/ThingSet.Client/ThingSetClient.cs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -85,17 +85,17 @@ public IEnumerable<ThingSetNode> GetNodes(ThingSetNodeEnumerationOptions options
8585

8686
public object? Get(uint id)
8787
{
88-
return DoRequest(ThingSetBinaryRequestType.Get, cw => cw.WriteUInt32(id));
88+
return DoRequest(ThingSetRequest.Get, cw => cw.WriteUInt32(id));
8989
}
9090

9191
public object? Get(string path)
9292
{
93-
return DoRequest(ThingSetBinaryRequestType.Get, cw => cw.WriteTextString(path));
93+
return DoRequest(ThingSetRequest.Get, cw => cw.WriteTextString(path));
9494
}
9595

9696
public object? Fetch(uint id, object arg)
9797
{
98-
return DoRequest(ThingSetBinaryRequestType.Fetch, cw =>
98+
return DoRequest(ThingSetRequest.Fetch, cw =>
9999
{
100100
cw.WriteUInt32(id);
101101
CborSerialiser.Write(cw, arg);
@@ -104,7 +104,7 @@ public IEnumerable<ThingSetNode> GetNodes(ThingSetNodeEnumerationOptions options
104104

105105
public object? Fetch(uint id, params object[] args)
106106
{
107-
return DoRequest(ThingSetBinaryRequestType.Fetch, cw =>
107+
return DoRequest(ThingSetRequest.Fetch, cw =>
108108
{
109109
cw.WriteUInt32(id);
110110
if (args.Length == 0)
@@ -120,7 +120,7 @@ public IEnumerable<ThingSetNode> GetNodes(ThingSetNodeEnumerationOptions options
120120

121121
public object? Fetch(string path)
122122
{
123-
return DoRequest(ThingSetBinaryRequestType.Fetch, cw =>
123+
return DoRequest(ThingSetRequest.Fetch, cw =>
124124
{
125125
cw.WriteTextString(path);
126126
cw.WriteNull();
@@ -129,7 +129,7 @@ public IEnumerable<ThingSetNode> GetNodes(ThingSetNodeEnumerationOptions options
129129

130130
public object? Update(string fullyQualifiedName, object value)
131131
{
132-
return DoRequest(ThingSetBinaryRequestType.Update, cw =>
132+
return DoRequest(ThingSetRequest.Update, cw =>
133133
{
134134
int index = fullyQualifiedName.LastIndexOf('/');
135135
string pathToParent = index > 0 ? fullyQualifiedName.Substring(0, index) : String.Empty;
@@ -145,7 +145,7 @@ public IEnumerable<ThingSetNode> GetNodes(ThingSetNodeEnumerationOptions options
145145

146146
public object? Exec(uint id, params object[] args)
147147
{
148-
return DoRequest(ThingSetBinaryRequestType.Exec, cw =>
148+
return DoRequest(ThingSetRequest.Exec, cw =>
149149
{
150150
cw.WriteUInt32(id);
151151
CborSerialiser.Write(cw, args);
@@ -154,22 +154,22 @@ public IEnumerable<ThingSetNode> GetNodes(ThingSetNodeEnumerationOptions options
154154

155155
public object? Exec(string path, params object[] args)
156156
{
157-
return DoRequest(ThingSetBinaryRequestType.Exec, cw =>
157+
return DoRequest(ThingSetRequest.Exec, cw =>
158158
{
159159
cw.WriteTextString(path);
160160
CborSerialiser.Write(cw, args);
161161
});
162162
}
163163

164-
private object? DoRequest(ThingSetBinaryRequestType action, Action<CborWriter> write)
164+
private object? DoRequest(ThingSetRequest action, Action<CborWriter> write)
165165
{
166166
byte[] buffer = new byte[4095];
167167
Span<byte> span = buffer;
168168
int length = 0;
169169
if (TargetNodeID.HasValue)
170170
{
171171
// prefix the request with node to forward to
172-
span[0] = (byte)ThingSetBinaryRequestType.Forward;
172+
span[0] = (byte)ThingSetRequest.Forward;
173173
CborWriter w = new CborWriter(CborConformanceMode.Lax);
174174
w.WriteTextString($"{TargetNodeID.Value:x}");
175175
w.Encode(span.Slice(1));

src/ThingSet.Common.Transports.Can/CanClientTransport.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ private void RunSubscriptionThread()
197197
if (type == MultiFrameMessageType.Single || type == MultiFrameMessageType.Last)
198198
{
199199
ReadOnlyMemory<byte> memory = buffer.Buffer;
200-
if (buffer.Buffer[0] == (byte)ThingSetBinaryRequestType.Report)
200+
if (buffer.Buffer[0] == (byte)ThingSetRequest.Report)
201201
{
202202
NotifyReport(memory.Slice(1, buffer.Position - 1));
203203
}

src/ThingSet.Common.Transports.Ip/IpClientTransport.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ private async void RunSubscriptionThread()
118118
buffer.Append(result.Buffer);
119119
}
120120
if ((messageType == MessageType.Last || messageType == MessageType.Single) &&
121-
buffer.Buffer[0] == (byte)ThingSetBinaryRequestType.Report)
121+
buffer.Buffer[0] == (byte)ThingSetRequest.Report)
122122
{
123123
ReadOnlyMemory<byte> memory = buffer.Buffer;
124124
var len = memory.Length;

src/ThingSet.Common/Protocols/Binary/ThingSetBinaryRequestType.cs renamed to src/ThingSet.Common/Protocols/Binary/ThingSetRequest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
*/
66
namespace ThingSet.Common.Protocols.Binary;
77

8-
public enum ThingSetBinaryRequestType : byte
8+
public enum ThingSetRequest : byte
99
{
1010
Get = 0x01,
1111
Exec = 0x02,

src/ThingSet.Common/Protocols/Text/ThingSetTextRequestType.cs renamed to src/ThingSet.Common/Protocols/Text/ThingSetRequest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
*/
66
namespace ThingSet.Common.Protocols.Text;
77

8-
public enum ThingSetTextRequestType : byte
8+
public enum ThingSetRequest : byte
99
{
1010
GetFetch = (byte)'?', /**< Function code for GET and FETCH requests in text mode. */
1111
Exec = (byte)'!', /**< Function code for EXEC request in text mode. */

src/ThingSet.Server/ThingSetServer.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -328,12 +328,12 @@ protected ThingSetRequestContextBase(Memory<byte> request)
328328

329329
internal class ThingSetBinaryRequestContext : ThingSetRequestContextBase
330330
{
331-
private readonly ThingSetBinaryRequestType _requestType;
331+
private readonly ThingSetRequest _requestType;
332332
private readonly CborReader _cborReader;
333333

334334
internal ThingSetBinaryRequestContext(Memory<byte> request) : base(request)
335335
{
336-
_requestType = (ThingSetBinaryRequestType)request.Span[0];
336+
_requestType = (ThingSetRequest)request.Span[0];
337337
_cborReader = new CborReader(request.Slice(1), CborConformanceMode.Lax, allowMultipleRootLevelValues: true);
338338

339339
CborReaderState state = _cborReader.PeekState();
@@ -370,8 +370,8 @@ internal ThingSetBinaryRequestContext(Memory<byte> request) : base(request)
370370
RequestBody = request.Slice(request.Length - _cborReader.BytesRemaining);
371371
}
372372

373-
public override bool IsGet => _requestType == ThingSetBinaryRequestType.Get;
374-
public override bool IsFetch => _requestType == ThingSetBinaryRequestType.Fetch;
375-
public override bool IsUpdate => _requestType == ThingSetBinaryRequestType.Update;
376-
public override bool IsExec => _requestType == ThingSetBinaryRequestType.Exec;
373+
public override bool IsGet => _requestType == ThingSetRequest.Get;
374+
public override bool IsFetch => _requestType == ThingSetRequest.Fetch;
375+
public override bool IsUpdate => _requestType == ThingSetRequest.Update;
376+
public override bool IsExec => _requestType == ThingSetRequest.Exec;
377377
}

0 commit comments

Comments
 (0)