Git Product home page Git Product logo

helyos-javascript-sdk's Introduction


Logo

helyOS Javascript SDK

A Javascript wrap for helyOS GrapQL interface.
Explore the docs »

View Demo · Report Bug · Request Feature

About The Project

The helyosjs-sdk helps the development of javascript applications using the helyOS framework. This library contains all necessary methods and entity types to build a front-end using helyOS as backend system.

List of features

  • Log in as administrator or regular user.
  • List and edit automatons (agents).
  • Retrieve sensors data and work process status.
  • Create, schedule and handle work processes.
  • Manage and edit yards: set drivable areas, gates, obstacles, etc.

Built With

Getting Started

Installation

$ npm i helyosjs-sdk  --save

Usage

import { HelyosServices, H_Agents  } from 'helyosjs-sdk';

const helyosService = new HelyosServices('http://localhost', {socketPort:'5002', gqlPort:'5000'});

const username = '[email protected]';
const password = 'password';

 helyosService.login(username, password)
.then( response => helyosService.connect())
.then( connected => console.log(connected));;

function listAgents {
    return helyosService.agents.list(0)
    .then((agents: H_Agent[]) => {
        console.log(agents);
    });
}

function editTool(patch: H_Agents) {
    return helyosService.agents.patch(patch)
    .then(agents => {
        console.log(agents);
    )}
}

Listening agent/agent sensors and work process status

helyosService.connect()
.then(() => {
            const socket = helyosService.socket;

            socket.on('new_agent_poses',(updates)=>{
                console.log(updates);  // Notifications from agent sensors.
            });

            socket.on('change_agent_status',(updates)=>{
                console.log(updates);  // Notifications from agents working status.
            });

            socket.on('change_work_processes',(updates)=>{
                console.log(updates);  // Notifications from work processes status.
            });
});

Command Reference

Command Description
helyosService.register(email,password,adminPassword): Promise Register new user.
helyosService.login(username, password): Promise User login.
helyosService.connect(): Promise Establish websocket connection after logged.
helyosService.logout(): Promise User logout.
helyosService.changePassword(user,password,newPassword): Promise Change password.
--- ---
EXAMPLE OF CRUD OPERATIONS
helyosService.workprocess Work Processes services
.list (condition: Partial<H_WorkProcess>): Promise<H_WorkProcess[]> list all work processes filtered by condition.
.create (data: H_WorkProcess): Promise<H_WorkProcess> create work process.
.get (workProcessId: number): Promise<H_WorkProcess> get work process by ID.
.patch (data:Partial<H_WorkProcess>): Promise<H_WorkProcess> edit work process.
--- ---

Most important models

Model Description
H_Agents Tool represents a sensor or any movable device that can perform an action
id: number unique db identifcation number
code: number unique identifcation number
name: string agent name
picture: string base64 jpg
yardId: number to which yard this agent is associated.
status: string 'busy', 'free'
picture: string base64 jpg
geometry: JSON Description of the agent geometry
heartbeat: Date Last time agent contacted the yard base
--- ---
H_Yard Physical space enclosing agents in a drivable area.
id: number unique db identifcation number
name: string yard name
picture: string base64 jpg
mapData: {origin: {lat?: number, lon?: number, zoomLevel?: number}} base64 jpg
--- ---
H_MapObject Define objects in the yard map: areas or lines.
id: number unique db identifcation number.
yardId: number associated yard.
deletedAt: Date when shape was marked deleted.
type: string type of object: "obstacle", "parking-area", "gate", etc.
data: Object user-defined arbitrary data format
dataFormat: string name of the data format
--- ---
H_WorkProcess Group and serialize actions to be executed by the agents.
id: number unique db identifcation number.
schedStartAt: date date and time when the process is scheduled to start.
schedEndAt: date date and time when the process is predicted to end.
startedAt: date date and time of actual start.
endedAt: date date and time of actual end.
status: string status.
processType: string status.
data: MoveToTargetDescriptor | MoveFreeDescription Any JSON data that describes the actions.
--- ---

Contributing

Keep it simple. Keep it minimal. If you have any question, please write to our Discussion forum.

License

This project is licensed under the MIT License

helyos-javascript-sdk's People

Contributors

cviolbarbosa avatar

helyos-javascript-sdk's Issues

convertLatLngToMM and convertMMtoLatLng should be moved to a separate module.

Issue Type: Code Improvement

Description:

The convertLatLngToMM and convertMMtoLatLng methods in the HelyosClient class are static-like, meaning they don't depend on the state of a HelyosClient instances. As per best practices, these utility functions should be moved to a separate module. This would make the code more modular, easier to maintain, and potentially increase reusability.

Current Behavior:

Currently, the convertLatLngToMM and convertMMtoLatLng methods are part of the HelyosClient class.

Expected Behavior:

These methods should be moved to a separate module, perhaps creating a new module (e.g., conversionUtils.ts).

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.