Code Monkey home page Code Monkey logo

alljoynclientlib's Introduction

AllJoynClientLib

An Universal Windows apps (UWP) Device Client Library for various common AllJoyn devices

Supported AllJoyn devices:

Sample App

The Sample app shows a simple dashboard of all devices. It also provides you with ViewModels for quick reuse in your own applications. Lastly it also shows how to create a custom device client plugin.

Install the Sample App From the store: https://www.microsoft.com/store/apps/9nblggh4wtcv

Usage:

Install nuget package:

PM> Install-Package dotMorten.AllJoyn.AllJoynClientLib

Sample code:

    //Initialize the device manager
    var manager = new AllJoynClientLib.DeviceManager();
    manager.DeviceJoined += Manager_DeviceJoined; //Listen for devices discovered
    manager.Start();
    
    // ...

    private async void Manager_DeviceJoined(object sender, DeviceClient device)
    {
      if(device is LightClient)
      { //We found a light
        var client = (LightClient)device;
        await client.SetOnOffAsync(true);         //turn on light
        if(await GetIsColorSupportedAsync())      //check the capability of light
          await client.SetColorAsync(Colors.Red); //Set the color of the light
      }
      else if (device is AllPlayClient)
      { //We found a media player
        var client = (AllPlayClient)device;
        await client.MediaPlayer.NextAsync();                   //Play next track
        var list = await client.MediaPlayer.GetPlaylistAsync(); //Get the current playlist
        await client.Volume.SetVolumeAsync(50);                 //Set volume
        client.MediaPlayer.PlayStateChanged += OnPlayStateChanged;
      }
    }

    private void OnPlayStateChanged(object sender, AllPlay.PlayState e)
    {
        //Media play state changed (start/stop/buffering/transitioning etc)
        string currentSong = e.CurrentMedia.Title;
    }

See the test app for more examples

Sample App Screenshots

image image image

alljoynclientlib's People

Contributors

dotmorten avatar

Stargazers

 avatar

Watchers

 avatar

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.