astarte-platform / astarte-device-sdk-csharp Goto Github PK
View Code? Open in Web Editor NEWLicense: Apache License 2.0
License: Apache License 2.0
Extend AstarteServerPropertyInterface to inherit IAstarteServerValueBuilder and IAstarteServerValuePublisher and implement its methods.
At this moment the pairing URL must be terminated with a slash /
, otherwise all pairing requests fails with 404
.
Maybe the issue regarding this code:
From C# URI docs:
This constructor creates a Uri instance by combining the baseUri
and the relativeUri
. If relativeUri
is an absolute URI (containing a scheme, host name, and optionally a port number), the Uri instance is created using only relativeUri.
If the baseUri has relative parts (like /api
), then the relative part must be terminated with a slash, (like /api/
), if the relative part of baseUri
is to be preserved in the constructed Uri.
Additionally, if the relativeUri
begins with a slash, then it will replace any relative part of the baseUri
This constructor does not ensure that the Uri refers to an accessible resource.
Dotnet-Uri-docs
Check the URL construction with the following URL examples:
Implement a logger with four log levels (Info, Error, Warn, Debug) and a standardized log message format: DateTime : LogLevel : Class name : Log message.
Replace all instances of Trace.WriteLine with the AstarteLogger.
The chars /
, +
and #
should not be allowed in endpoint parameters.
This is due to MQTT specifications. As +
and #
are used as wildcards and /
is used as a path separator.
Add to the example:
individual datastream
object datastream
property
Make a new global event listener abstract class and inherit IAstartePropertyEventListener, IAstarteDatastreamEventListener, and IAstarteAggregateDatastreamEventListener.
Create methods for adding and removing event listeners for all interfaces on the device.
Handle the MQTT persistent session in the Astarte way.
Astarte has support for the concept of properties, which are kept synchronized between the server and the device.
Astarte (or the broker) might be inconsistent with a Device's known status and its known properties. Although unlikely, as Astarte should always keep knowledge about remote device status, this might happen, for example, after an internal error. Astarte performs this task by telling the broker to disconnect the device and clear its session. After this, when the device will attempt reconnection, session present
will be false.
After a clean session properties might be purged.
https://docs.astarte-platform.org/latest/080-mqtt-v1-protocol.html#session-present
Rename
namespace AstarteDeviceSDKCSharp.Protocol.AstarteExeption to
namespace AstarteDeviceSDKCSharp.Protocol.AstarteException
Astarte action
Create GitHub action using Astarte cluster workflow.
Method Build in AstarteServerAggregateDatastreamInterface class thow exemption. The exemption is "Can not explicitly casting the object to byte[]".
using (MemoryStream ms = new MemoryStream((byte[])serverValue))
{
using (BsonDataReader reader = new BsonDataReader(ms))
{
JsonSerializer serializer = new JsonSerializer();
astartePayload = serializer.Deserialize<Dictionary<string, object>>(reader);
}
}
MemoryStream change with this code
astartePayload = JsonConvert.DeserializeObject
<Dictionary<string, object>>(JsonConvert.SerializeObject(serverValue));
Check if the Connect
function, when the certificate expires, requests a new certificate to the Astarte Instance.
For testing, you can run an Astarte instance locally and reduce the certificate expiration for example to 5 minutes after that:
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.