Code Monkey home page Code Monkey logo

astarte-device-sdk-csharp's People

Contributors

ackermannw avatar bettio avatar harlem88 avatar nedimtokic avatar osmanhadzic avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

astarte-device-sdk-csharp's Issues

Incorrect build of PairingURL

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:

_pairingUrl = new Uri(_pairingUrl, "v1");

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 c# logging

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.

Improve example

Add to the example:

  • How to receive an individual datastream
  • How to transmit/receive an object datastream
  • How to set/unset a property

Compose event listeners to the global event listener

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.

Handling session present and its interaction with properties

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

Fix misspelling in namespace

Rename
namespace AstarteDeviceSDKCSharp.Protocol.AstarteExeption to
namespace AstarteDeviceSDKCSharp.Protocol.AstarteException

[Fix] Deserializing Object in Build Method

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));

Renewal the Certificate after expiration

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:

  1. Connect a device
  2. Send some data
  3. Disconnect a device for six minutes
  4. Reconnect the device
  5. Check if the connection was successful
  6. Check if the device sends data without issue

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.