How to use the thingpedia.BaseClient function in thingpedia

To help you get started, we’ve selected a few thingpedia examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github stanford-oval / almond-dialog-agent / test / mock_schema_delegate.js View on Github external
// Copyright 2018-2019 The Board of Trustees of the Leland Stanford Junior University
//
// Author: Giovanni Campagna 
//
// See COPYING for details
"use strict";

const assert = require('assert');
const ThingTalk = require('thingtalk');
const Tp = require('thingpedia');
const fs = require('fs');
const path = require('path');
const util = require('util');
const ThingpediaDeviceFactories = require('./thingpedia-device-factories.json');

class MockThingpediaClient extends Tp.BaseClient {
    constructor() {
        super(null);
        this._devices = null;
        this._entities = null;

        this._thingpediafilename = path.resolve(path.dirname(module.filename), 'thingpedia.tt');
        this._loaded = null;
    }

    get developerKey() {
        return null;
    }
    get locale() {
        return this._locale;
    }
github stanford-oval / almond-cloud / tests / unit / file_thingpedia_client.js View on Github external
//
// This file is part of Genie
//
// Copyright 2018-2019 The Board of Trustees of the Leland Stanford Junior University
//
// Author: Giovanni Campagna 
//
// See COPYING for details
"use strict";

const ThingTalk = require('thingtalk');
const Tp = require('thingpedia');
const fs = require('fs');
const util = require('util');

module.exports = class FileThingpediaClient extends Tp.BaseClient {
    constructor(args) {
        super({ locale: args.locale, getDeveloperKey() { return null; } });
        this._locale = args.locale;
        this._devices = null;
        this._entities = null;

        this._thingpediafilename = args.thingpedia;
        this._entityfilename = args.entities;
        this._datasetfilename = args.dataset;
        this._loaded = null;
    }

    get developerKey() {
        return null;
    }
    get locale() {
github stanford-oval / almond-cloud / util / thingpedia-client.js View on Github external
getAllKinds(deviceId) {
        return this.getAllDiscoveryServices(deviceId).then((services) => services.map((s) => {
            return { kind: s.discovery_type + s.service };
        }));
    }

    getByPrimaryKind(kind) {
        return db.withClient((dbClient) => device.getByPrimaryKind(dbClient, kind));
    }
}

var _discoveryServer = new TpDiscovery.Server(new ThingpediaDiscoveryDatabase());

const CATEGORIES = new Set(['media', 'social-network', 'home', 'communication', 'health', 'service', 'data-management']);

module.exports = class ThingpediaClientCloud extends Tp.BaseClient {
    constructor(developerKey, locale, dbClient = null) {
        super();

        this._developerKey = developerKey;
        this._locale = locale;
        this.language = I18n.localeToLanguage(locale);

        this._dbClient = null;
    }

    get developerKey() {
        return this._developerKey;
    }

    get locale() {
        return this._locale;