lavva.webbluetooth
Version:
Library implementing WebBluetooth custom functionality if underlying platform does support it
176 lines • 6.94 kB
JavaScript
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
export class DeviceStore {
GetSupportedDevicesAsync(integration, lang) {
return __awaiter(this, void 0, void 0, function* () {
//updates.tr7.pl/supportedDevices/pl-PL.json
const url = `https://updates.tr7.pl/supportedDevices/${integration}/${lang}.json`;
let res = yield fetch(url, { method: 'GET' });
if (res.ok)
return JSON.parse(yield res.text());
else
throw new Error("Failed to download supported devices list!");
});
}
}
export var IntegrationType;
(function (IntegrationType) {
IntegrationType["Lavva"] = "lavva";
IntegrationType["Exalus"] = "exalus";
IntegrationType["Wisniowski"] = "wisniowski";
})(IntegrationType || (IntegrationType = {}));
export var Language;
(function (Language) {
Language["En"] = "en";
Language["De"] = "de";
Language["Pl"] = "pl";
Language["It"] = "it";
Language["Es"] = "es";
Language["Fr"] = "fr";
Language["Ro"] = "ro";
Language["Hu"] = "hu";
Language["Lt"] = "lt";
Language["No"] = "no";
Language["Fi"] = "fi";
Language["Sv"] = "sv";
Language["Nl"] = "nl";
Language["Pt"] = "pt";
Language["Cz"] = "cz";
Language["Uk"] = "uk";
Language["Unknown"] = "en";
})(Language || (Language = {}));
export var ProductType;
(function (ProductType) {
ProductType[ProductType["Unknown"] = 0] = "Unknown";
ProductType[ProductType["Remote"] = 1] = "Remote";
ProductType[ProductType["BlindController"] = 2] = "BlindController";
ProductType[ProductType["LightController"] = 3] = "LightController";
ProductType[ProductType["HeatingController"] = 4] = "HeatingController";
ProductType[ProductType["FacadeBlindController"] = 5] = "FacadeBlindController";
ProductType[ProductType["GateController"] = 6] = "GateController";
ProductType[ProductType["DoorController"] = 7] = "DoorController";
ProductType[ProductType["GatewayController"] = 8] = "GatewayController";
ProductType[ProductType["Sensor"] = 9] = "Sensor";
ProductType[ProductType["SwitchController"] = 10] = "SwitchController";
ProductType[ProductType["Meters"] = 11] = "Meters";
ProductType[ProductType["Cameras"] = 12] = "Cameras";
ProductType[ProductType["Intercoms"] = 13] = "Intercoms";
ProductType[ProductType["GarageDoorController"] = 14] = "GarageDoorController";
ProductType[ProductType["FencesWicketGatesAndGatesController"] = 15] = "FencesWicketGatesAndGatesController";
})(ProductType || (ProductType = {}));
export class SupportedDevice {
constructor() {
this.ModelGuid = "";
/// <summary>
/// Tells if the device requires a EFC-04 controller to work.
/// </summary>
this.RequiresController = false;
/// <summary>
/// The name of the device in the form of a map of key-value pairs. The key is the language code and the value is the name in that language.
/// </summary>
this.ModelName = "";
/// <summary>
/// The guid of manufacturer of the device.
/// </summary>
this.ManufacturerGuid = "";
/// <summary>
/// The name of the manufacturer of the device.
/// </summary>
this.ManufacturerName = "";
/// <summary>
/// The guid of the device's protocol.
/// </summary>
this.DeviceProtocolGuid = "";
/// <summary>
/// The name of the device's protocol.
/// </summary>
this.DeviceProtocolName = "";
/// <summary>
/// The list of the device's groups like ExtaLife, ExalusHome, etc.
/// </summary>
this.ProductGroups = [];
this.ProductTypes = [];
/// <summary>
/// Device name
/// </summary>
this.Name = "";
/// <summary>
/// The description of the device (in markdown format, should support images also)
/// </summary>
this.Description = "";
/// <summary>
/// The parameters of the device in the form of a map of key-value pairs. The key is the name of the parameter and the value is the value of the parameter.
/// For example, for a blind controller, the parameters could be: "MaxCurrent": "10A", "Voltage": "230V", etc.
/// The parameters are used to display additional information about the device
/// </summary>
this.DeviceParameters = {};
/// <summary>
/// Promotional video.
/// </summary>
this.PromoVideo = null;
/// <summary>
/// The list of links to the pictures of the device.
/// </summary>
this.Pictures = [];
/// <summary>
/// Show on control grid as device demo.
/// </summary>
this.ShowAsDeviceDemo = false;
/// <summary>
/// The places where the device can be bought
this.WhereToBuy = [];
/// <summary>
/// The list of links to the manuals and documents of the device.
/// </summary>
this.ManualsAndDocuments = [];
/// <summary>
/// The list of links to the videos for this device.
/// </summary>
this.Videos = [];
/// <summary>
/// The instructions how to add the device to the system.
/// </summary>
this.DeviceAddingInstructions = new DeviceAddingInstruction();
}
}
export class DeviceAddingInstruction {
constructor() {
/// <summary>
/// url to te image that will be displayed on the device adding screen as instruction how to add the device, for example a picture of the device.
/// </summary>
this.ImageOnList = "";
/// <summary>
/// instruction in markdown format (should support images also)
/// </summary>
this.Instruction = "";
}
}
export class ExternalSite {
constructor() {
this.Id = "";
this.Name = "";
this.Link = "";
}
}
export class Video {
constructor() {
this.Id = "";
this.Title = "";
this.Link = "";
}
}
export class ExternalDocument {
constructor() {
this.Id = "";
this.Title = "";
this.Link = "";
}
}
//# sourceMappingURL=DeviceStore.js.map