Giter Site home page Giter Site logo

c-mesh-api's Introduction

Wirepas Mesh API

This repository contains a C implementation of the Wirepas Dual MCU API. The Dual MCU API allows the exchange of data between a host and a Wirepas node via UART. The C-Mesh library is used by the Wirepas Gateway software but can also be used in case of a Dual MCU architecture.

C Library

The C implementation is available from lib and is structured in the following folders:

  • api: header files for the WM dual mcu api
  • platform: host platform functions for interface handling
  • wpc: implementation of the WM dual mcu api

An example on how to use and extend the library is available from:

Tests

To run the tests you will to connect a device running WM's dual mcu api on your host machine.

Build the tests with

    cd test
    make

Execute the test suite with

    ./build/meshAPItest

Contributing

We welcome your contributions!

Please read the instructions on how to do it and please review our code of conduct.

License

Wirepas Oy licensed under Apache License, Version 2.0 See file LICENSE for full license details.

c-mesh-api's People

Contributors

arisiuvatti avatar gwendalraoul avatar gwendalraoul-p avatar jannesiren avatar josua-sr avatar jy-wirepas avatar pfigs avatar sebpellorce avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

c-mesh-api's Issues

Serial frames as test vector for interface testing

Issue description
The current tests require a serial port and a WM device in order to execute

Suggestion
Write test vectors based on pre-acquired serial frames, which can be used for regression and unit testing of the interface methods.

question: usable for implementation on microcontroller?

I want to use the Dual MCU chip (actually the Thetis-I from Würth Elektronik) connected through UART to an embedded microcontroller (stm32).
Unfortunately the official Wirepas Massive Dual-MCU API Reference Manual is not accessible, so i am struggling with finding any documentation for this scenario.

Can I use this library as a starting point? Can anyone point me in the proper direction? Is this relatively simple? are there any caveats to expect?

lib/platform/linux/platform.c: polling thread accesses indication queue variables without mutex held

While doing upgrade from earlier WPC API library to c-mesh-api/master, we noticed this issue during code review.

In lib/platform/linux/platform.c, dispatch queue accesses indication queue with m_queue_mutex held. However, polling thread is accessing indication queue variables without taking mutex, for example at
https://github.com/wirepas/c-mesh-api/blob/master/lib/platform/linux/platform.c#L177

Add multicast support

This api wrapper doesn't have function to assign a group to the node that is part of the Dual MCU api.

On a sink it doesn't make a lot of sense but c-mesh-api can be used on any node where it makes much more sense.

CMake builds

I was using this library and felt CMake would have helped with IDEs in navigation and builds platforms like macOS (when platform support is added in future). Is usage of Makefile over CMakeLists intentional? If not, shall I submit a pull request?

Platform_lock_request return value not evaluated

The platform_lock_request() function returns a bool. The desired behaviour regarding the return value is not described in the platform.h file but looking at the linux implementation, false is returned when no lock can be aquired (see https://github.com/wirepas/c-mesh-api/blob/master/lib/platform/linux/platform.c#L245).

However, in the API (wpc) the return value of Platform_lock_request() is never checked, e.g. see here https://github.com/wirepas/c-mesh-api/blob/master/lib/wpc/wpc_internal.c#L332. In the mentioned example the code after Platform_lock_request() is executed even if no lock can be acquired.
The callers of the Platform_lock_request() are mostly located in the functionality and are not intended to be changed by a user/customer.
Should the return value of Platform_lock_request() not be evaluated and corresponding actions implemented if the lock can not be acquired?

[ERROR] wpc_int:Didn't receive answer to the request 0x0c

Hi, managed to compile the example but it seems it can't connect to the sink...

Setup:

  • wirepas (dual mcu) usb dongle connected to a computer which is acting as a sink.
  • wirepas (dual mcu) connected to usb this computer acting als non-routing node

I have tested this setup using wirepas commander and was able to send/receive data using this tool, so i now try to use the c-mesh-api example app to act as non-routing node to connect to the sink but I can't find any info on what the example is doing (trying to do).

I used these settings:

// Default serial port
char * port_name = "/dev/ttyUSB0";

// Node configuration
#define NODE_ADDRESS 0x02
#define NODE_ROLE APP_ROLE_SUBNODE
#define NETWORK_CHANNEL 0x17
#define NETWORK_ADDRESS 0x0C3B05

After compiling, i get these logs:

pi@raspberrypi:~/projects/wirepas-sink/src/c-mesh-api-master/example/build $ ./meshAPIExample 
2022-10-08 07:27:29,440 | [DEBUG] SERIAL:Custom bitrate set: 115200
2022-10-08 07:27:29,442 | [INFO] wpc_int:WPC initialized
2022-10-08 07:27:29,961 | [ERROR] wpc_int:Didn't receive answer to the request 0x04
2022-10-08 07:27:29,962 | [ERROR] wpc_int:No poll answer
2022-10-08 07:27:30,481 | [ERROR] wpc_int:Didn't receive answer to the request 0x06
2022-10-08 07:27:31,502 | [ERROR] wpc_int:Didn't receive answer to the request 0x0c
2022-10-08 07:27:32,026 | [ERROR] wpc_int:Didn't receive answer to the request 0x0c
[..]
2022-10-08 07:28:29,237 | [ERROR] wpc_int:Didn't receive answer to the request 0x0c
2022-10-08 07:28:29,757 | [ERROR] wpc_int:Didn't receive answer to the request 0x0c
2022-10-08 07:28:29,758 | [WARNING] linux_plat:Exiting dispatch thread

Can someone explain what is going wrong here? I just want to send some data from the non-routing-node to the sink

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.