Skip to content
This repository has been archived by the owner on Jun 3, 2022. It is now read-only.
/ cmqtt Public archive

CMQTT - MQTT Broker for Crestron

License

Notifications You must be signed in to change notification settings

anpin/cmqtt

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

78 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CMQTT

NuGet

CMQTT - MQTT Broker and Client for Crestron S#Pro framework

This repository is port of GnatMQ for Crestron S#Pro framework

Description

A broker (server) for the MQTT protocol, an M2M Internet-of-Things communication protocol based on .Net Framework.

MQTT, short for Message Queue Telemetry Transport, is a light weight messaging protocol that enables embedded devices with limited resources to perform asynchronous communication on a constrained network.

Developed by IBM and Eurotech, the MQTT protocol is released as an open standard and being standardized by OASIS (Organization for the Advancement of Structured Information Standard), a non-profit consortium that drives the development, convergence and adoption of open standards for the global information society.

In general, the MQTT environment consists of multiple clients and a server, called broker.

This project is created to develop an MQTT broker. While there are other MQTT broker project, this project is created to provide additional resources to learn and engage in developing useful resources for the MQTT protocol, in conjunction with the M2Mqtt project, a .NET client library for MQTT that supports .NET Framework, .NET Compact Framework and .NET Micro Framework.

How to use:

nuget install CMQTT -OutputDirectory .\packages

Starting the server is simple:

using CMQTT;
namespace Server
{
    public class ControlSystem : CrestronControlSystem
    {
        MqttBroker broker;
        ...
        public override void InitializeSystem()
        {
            // create and start broker
            broker = new MqttBroker();
            broker.Start();
            //Once the broker is started, you applciaiton is free to do whatever it wants. 
        }
        ...
        void ControlSystem_ControllerProgramEventHandler(eProgramStatusEventType programStatusEventType)
        {
            switch (programStatusEventType)
            {
                case (eProgramStatusEventType.Stopping):
                    broker.Stop();
                    break;
            }

        }
        ...
    }
}

Please refer to the Server project for the full example with local client running in the same program

Supported Platforms:

  • Crestron 3-series controllers (see warning below)
  • Crestron 4-series controllers

3-series compatibility warning

While it compiles with VS2008 for 3-series controllers further tests showed that it takes almost 100% CPU on AV3 with a small number of clients connected. It gets especially worse (stack overflow with consequent reboot) if you try to run a local client in a separate program, so far we were not able to resolve the issue and advice against using this code in production

About

CMQTT - MQTT Broker for Crestron

Resources

License

Stars

Watchers

Forks