Simple BACnet implementation for PIC Microcontroller - pic

I am designing a Fire Alarm System. Main Panel will act as Master. Manual
Call Point Units will act as Slaves.Hence there will be
only one Master. I want to use RS485. I am not using TCP/IP Data link. My
few doubts/questions are as follows:
For such a small setup can I use BACnet as my communication Protocol?
If yes, I am wondering to use which data link i should be using, because
every subsystem seems to be Multi Master [e.g. MS/TP].
In case if it is decided to use the BACnet for my project. Which files
from sources I should use. Considering minimum services
required. Initially it should be a bare minimum for the sake of
understanding, later i can upgrade the system.
I have gone through the demo examples for PIC microcontrollers. But
unable to understand it .
Please help.

Yes, you can use BACnet for the communication Protocol. Over RS485 it would be BACnet MSTP.
BACnet MSTP is Multi-Master, but you can have slave devices that use MAC address above 127. It gets complex when adding slave devices, lots of gotchas.
I can't help you with the open-source BACnet stacks. The BACnet protocol is quite large, even to support the basics. Look into the BACnet profile for B-SS for the smallest subset of BACnet services.

Related

Detect network connection availability changes

I am writing a Go application for Mac and Windows, which will perform some action whenever there is a network change( Client move from Wi-fi 1 to Wi-fi 2 or to 3G to LAN). I am aware of a solution for Application running on mac in swift language but I am looking for a platform-agnostic solution here.
So far I have tried checking for an event on an interface but I am not sure if that is sufficient.
I expect that on a network change (moving from Wifi-1 to Wifi-2 or 3G or LAN) my Go app should be able to know to take some action.
I doubt there would be such a solution.
Every project which tries to provide some platform-agnostic solution to an inherently OS-tied problem inevitably hides the platform-specific details behind a common API.
Look at https://github.com/fsnotify/fsnotify for a good example.
So, I'd take that route and would have put up a package which would have two platform-specific "backends" which would be compiled conditionally using build tags.
To get notified about network-related events under Windows,
you should probably start here.
Unfortunately, this stuff is COM-oriented, but you could use https://github.com/go-ole/go-ole to help with that.
You might also ask a non-Go-specific question tagged winapi to ask about what would be the best way to hook into the kernel to get notified about the availability of the networks.
There is no platform agnostic solution that exists, however platforms like OSx,Linux,Windiws has ways to get network events with their platform specific limitations.
OSx: Raw socket SOCK_RAW of AF_ROUTE type can be used to detect any network events that occurs in user machine. there are various types of network event that can be detected.
This thread talk about an example on BSD for network event
Windows : Windows has its APIs given as part of iphlpapi library. APIs like NotifyAddrChange, NotifyRouteChange allows you to have almost all network events( apart from metric change etc.) this git repo has a working example NotifyAddrChange, which gives back and event whenever a interface goes down or comes up.
Linux : In Linux netlink sockets allows a user space application to receive network events using netlink sockets.

How to use Python to communicate with NIC PCIe

I am testing a custom FPGA NIC and I need to send management information (such as header info for matching) and traffic data to it using a traffic generator from within the user space.
The driver built for the FPGA is a modified version of IXGBE with DMA support for management, and also supports DPDK for kernel bypass to achieve high throughput.
I am trying to understand how the various software (driver, userspace application, etc) should be stacked/connected to each-other so I can achieve the objective of reading and writing to PCIe on the NIC using set of scripts from user space?
I have also been looking at this project
https://github.com/CospanDesign/python-pci
which is useful however based on Xilinx XDMA.
Would appreciate any help, pointers on this.
Sorry, the question is too broad. For such a broad question there is a generic answer: have a look at Inter Process Communication:
https://en.wikipedia.org/wiki/Inter-process_communication
There are variety of methods, like Unix sockets, shared memory, netlink etc, to communicate between user space processes. As well as a variety of methods to communicate between user space and kernel space.
Just pick the best for you and try to do something. If it fails, come again on SO and ask ;)

Can i have two clients use DJI onboard SDK to talk with the craft?

Can i have two clients use DJI onboard SDK to talk with the craft?
For example, one to read the flight data, and another to set command to craft.
Not officially supported.
You could engineer a solution that involves your 'read' client merely sniffing the UART line for broadcast data, and your 'write' client implementing a full bidirectional communication. You do not need to obtain control of the aircraft to receive broadcast data, so this solution could work.
Bear in mind though that adding a fragile sniffing solution will give you low robustness and should be used with extreme caution on a flying robot.

How to test reliability of my Veins simulations?

I am developing Car2X applications in order to simulate case studies based on Veins framework.
As an Information Systems student, I have been worried mostly about the code of my applications.
Recently I noticed that VEINS has no LLC, NETWORK and TRANSPORT layers in its source code (/src).
My question is: how to assure that my simulation runs would generate data close to reality for Car2X applications when there's none of these layers above in the source code?
P.S.: I am aware of INET framework and its protocols, I was just wondering if I could use just Veins for my case studies :)
The layers you mentioned are not needed for most Car2X simulations. If you download, for example, Veins 4.4, you will find only simulation models for single hop broadcast transmission of frames, the most general use case. If you want to simulate a special protocol, say, for multi-hop transmission of frames, you will need to implement this as a network layer. Then, your simulation will have a network layer model.

Is there a framework for writing a decentral application?

If I want to write a node for a P2P application (like Bitcoin, Bitorrent, etc.) there are a lot of parts that are the same:
I need to bootstrap to the network (discover other peers)
I need to manage a list of peers, and monitor their states
I need to retrieve lists of more peers from my neighbour peers
Etc, etc.
Since I don't want to re-invent the wheel, is their a framework that I could as a sort of base library to build on?
You mention both bitcoin and bittorrent, which are quite different, so I'm assuming you don't want to be bound to any specific protocol or even serialization format.
And yet you mention peer-discovery and stats-management which are high-level concerns, be built on top of some network protocol.
But the protocol dictates how such a mechanism would work.
It sortof sounds like you're asking if there are pre-built roofs that would fit on skyscrapers just as well as on a wood cabin.
So if you actually want to design your own protocol you probably should look more at the foundation first.
which language do you want to use
what IO / event processing libraries are available
what protocol parsers and serializers are available
do you aim for throughput? low memory footprint? low latency? minimal amount of programmer-hours spent?
what kind of security is needed? heavy crypto use at the protocol level will need a trustworthy crypto library (don't roll your own!)
what kind of auxiliary things do you need (where does the data go? filesystem? databases? do you need a UI?)
Alternatively, depending how one interprets your question, if you want to write a client for a specific network then you should simply look for a library implementing the core concepts of that specific network while freeing you up to implement the rest of the application.
In bittorrent's case such an example would be libtorrent

Resources