Skip to content

Attempt to create unified API to control Enigma1 & Enigma2 web interfaces in Dart language

License

Notifications You must be signed in to change notification settings

shaxxx/EnigmaWeb.Dart

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

72 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

EnigmaWeb

This library is conversion of EnigmaWeb to Dart language. Works with both Enigma1 and Enigma2 web interfaces.

First thing to do is to setup profile information

var profile = Profile();
profile.address = "192.168.0.2";
profile.httpPort = 80;
profile.enigma = EnigmaType.enigma2;
profile.username = "root";
profile.password = "password";

Execute command

All available web commands are implemented, just execute command and read response from object model, ie.

    //initialize parser to parse response to read current service from receiver
    var currentServiceResponseParser = GetCurrentServiceParser();
    //initialize http client implementation to send HTTP requests to receiver
    var webRequester = WebRequester(Logger.root);
    //initialize get current service command object
    var command = GetCurrentServiceCommand(currentServiceResponseParser, webRequester);
    //execute command and get typed result
    GetCurrentServiceResponse response = await command.executeAsync(profile);
    //use result
    print(response.currentService);
    print(response.responseDuration);

    //some commands dont need parsing (IE. we're not interested in result, just if command was successfull)
    //for that we use UnparsedParser<TCommand>, for example WakeUp command to wake up Enigma
    var noParsing = UnparsedParser<WakeUpCommand>();
    // perform WakeUp command, and just wait for it to finish
    await WakeUpCommand(noParsing, requester).executeAsync(profile);

About

Attempt to create unified API to control Enigma1 & Enigma2 web interfaces in Dart language

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages