Skip to content

Commit

Permalink
refactor: ACAEngine -> PlaceOS, engine-drivers -> drivers
Browse files Browse the repository at this point in the history
  • Loading branch information
caspiano committed Mar 9, 2020
1 parent 82af9e2 commit 984d396
Show file tree
Hide file tree
Showing 45 changed files with 135 additions and 136 deletions.
2 changes: 1 addition & 1 deletion .ameba.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ Lint/UnreachableCode:
Enabled: true
Severity: Warning
Excluded:
- repositories/private_drivers/lib/engine-driver/src/engine-driver/protocol/management.cr
- repositories/private_drivers/lib/driver/src/driver/protocol/management.cr

# Run `ameba --only Style/VariableNames` for details
Style/VariableNames:
Expand Down
2 changes: 1 addition & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"name": "Debug",
"type": "gdb",
"request": "launch",
"target": "./bin/engine-drivers",
"target": "./bin/test-harness",
"cwd": "${workspaceRoot}",
"preLaunchTask": "Compile",
"setupCommands": [
Expand Down
2 changes: 1 addition & 1 deletion .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"tasks": [
{
"label": "Compile",
"command": "shards build --debug engine-drivers",
"command": "shards build --debug drivers",
"type": "shell"
}
]
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@ RUN shards build --error-trace --production

# Run the app binding on port 8080
EXPOSE 8080
ENTRYPOINT ["/src/bin/engine-drivers"]
CMD ["/src/bin/engine-drivers", "-b", "0.0.0.0", "-p", "8080"]
ENTRYPOINT ["/src/bin/test-harness"]
CMD ["/src/bin/test-harness", "-b", "0.0.0.0", "-p", "8080"]
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Crystal Engine Drivers
# PlaceOS Drivers

[![Build Status](https://travis-ci.org/aca-labs/crystal-engine-drivers.svg?branch=master)](https://travis-ci.org/aca-labs/crystal-engine-drivers)
[![Build Status](https://travis-ci.org/placeos/drivers.svg?branch=master)](https://travis-ci.org/placeos/drivers)

Manages and tests engine drivers
Manage and test [PlaceOS](https://place.technology) drivers.

## Development

Expand Down
24 changes: 12 additions & 12 deletions docs/directory_structure.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
# Directory Structures

Engine core / drivers makes the assumption that the working directory one level
PlaceOS core / drivers makes the assumption that the working directory one level
up from the scratch directory. An example deployment structure:

* Working dir: `/home/engine/core`
* Executable: `/home/engine/core/bin/core`
* Driver repositories: `/home/engine/repositories`
* ACA Drivers: `/home/engine/repositories/aca-engine-drivers`
* Driver executables: `/home/engine/core/bin/drivers`
* Samsung driver: `/home/engine/core/bin/drivers/353b53_samsung_display_md_series_cr`
* Working dir: `/home/placeos/core`
* Executable: `/home/placeos/core/bin/core`
* Driver repositories: `/home/placeos/repositories`
* PlaceOS Drivers: `/home/placeos/repositories/drivers`
* Driver executables: `/home/placeos/core/bin/drivers`
* Samsung driver: `/home/placeos/core/bin/drivers/353b53_samsung_display_md_series_cr`

However when developing the structure will look more like:

* Working dir: `/home/steve/aca-engine-drivers`
* Driver repository: `/home/steve/aca-engine-drivers`
* Driver executables: `/home/steve/aca-engine-drivers/bin/drivers`
* Samsung driver: `/home/engine/core/bin/drivers/353b53_samsung_display_md_series_cr`
* Working dir: `/home/steve/drivers`
* Driver repository: `/home/steve/drivers`
* Driver executables: `/home/steve/drivers/bin/drivers`
* Samsung driver: `/home/placeos/core/bin/drivers/353b53_samsung_display_md_series_cr`

The primary difference between production and development is engine core, in production, will be cloning repositories and installing shards as required.
The primary difference between production and development is PlaceOS core, in production, will be cloning repositories and installing shards as required.
6 changes: 3 additions & 3 deletions docs/http-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Returns the list of available drivers

```json

["drivers/aca/spec_helper.cr", "..."]
["drivers/place/spec_helper.cr", "..."]
```


Expand Down Expand Up @@ -94,7 +94,7 @@ Lists the available specs

```json

["drivers/aca/spec_helper_spec.cr", "..."]
["drivers/place/spec_helper_spec.cr", "..."]
```


Expand Down Expand Up @@ -130,7 +130,7 @@ Compiles and runs a spec and returns the output

```text
Launching spec runner
Launching driver: /Users/steve/Documents/projects/crystal-engine/crystal-engine-drivers/bin/drivers/drivers_aca_private_helper_cr_4f6e0cd
Launching driver: /Users/steve/Documents/projects/placeos/drivers/bin/drivers/drivers_place_private_helper_cr_4f6e0cd
... starting driver IO services
... starting module
... waiting for module
Expand Down
9 changes: 4 additions & 5 deletions docs/setup.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
# Setup

This allows you to build and test drivers without installing or running the complete
ACA Engine service.
This allows you to build and test drivers without installing or running the complete PlaceOS service.

1. clone the drivers repository: `git clone https://github.com/aca-labs/crystal-engine-drivers engine-drivers`
2. clone private repositories here: `mkdir ./engine-drivers/repositories`
1. clone the drivers repository: `git clone https://github.com/placeos/drivers drivers`
2. clone private repositories here: `mkdir ./drivers/repositories`


## OSX
Expand All @@ -26,7 +25,7 @@ export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/opt/openssl/lib/pkgconfig
## Running Specs

1. Ensure redis is running: `redis-server`
2. Install dependencies: `cd engine-drivers; shards update`
2. Install dependencies: `cd drivers; shards update`
3. Launch application: `crystal run ./src/app.cr`
4. Browse to: http://localhost:3000/

Expand Down
6 changes: 3 additions & 3 deletions docs/writing-a-driver.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ end
# A common received function for handling responses
def received(data, task)
# data is always `Bytes`
# task is always `ACAEngine::Driver::Task?` (i.e. could be nil if no active task)
# task is always `PlaceOS::Driver::Task?` (i.e. could be nil if no active task)
# convert data into the appropriate format
data = String.new(data)
Expand Down Expand Up @@ -201,7 +201,7 @@ sys.bookable #=> true
sys.id #=> "sys-tem~id"
sys.modules #=> ["Array", "Of", "Unique", "Module", "Names", "In", "System"]
sys.count("Module") #=> 3
sys.implementing(ACAEngine::Driver::Interface::Powerable) #=> ["Camera", "Display"]
sys.implementing(PlaceOS::Driver::Interface::Powerable) #=> ["Camera", "Display"]
# Look at status on a remote module
system[:Display][:power] #=> true
Expand Down Expand Up @@ -377,7 +377,7 @@ Metadata is used by various components to simplify configuration.

```crystal
class MyDevice < ACAEngine::Driver
class MyDevice < PlaceOS::Driver
generic_name :Driver
descriptive_name "Driver model Test"
description "This is the driver used for testing"
Expand Down
4 changes: 2 additions & 2 deletions drivers/aca/spec_helper.cr
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module ACA; end
module Place; end

class ACA::SpecHelper < ACAEngine::Driver
class Place::SpecHelper < PlaceOS::Driver
def implemented_in_driver
"woot!"
end
Expand Down
2 changes: 1 addition & 1 deletion drivers/bose/control_space_serial.cr
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module Bose; end

# Documentation: https://aca.im/driver_docs/Bose/Bose-ControlSpace-SerialProtocol-v5.pdf

class Bose::ControlSpaceSerial < ACAEngine::Driver
class Bose::ControlSpaceSerial < PlaceOS::Driver
# Discovery Information
tcp_port 10055
descriptive_name "Bose ControlSpace Serial Protocol"
Expand Down
2 changes: 1 addition & 1 deletion drivers/cisco/switch/snooping_catalyst.cr
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module Cisco::Switch; end

require "set"

class Cisco::Switch::SnoopingCatalyst < ACAEngine::Driver
class Cisco::Switch::SnoopingCatalyst < PlaceOS::Driver
# Discovery Information
descriptive_name "Cisco Catalyst Switch IP Snooping"
generic_name :Snooping
Expand Down
4 changes: 2 additions & 2 deletions drivers/floorsense/desks.cr
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ module Floorsense; end

# Documentation: https://documenter.getpostman.com/view/8843075/SVmwvctF?version=latest#3bfbb050-722d-4433-889a-8793fa90af9c

class Floorsense::Desks < ACAEngine::Driver
class Floorsense::Desks < PlaceOS::Driver
# Discovery Information
generic_name :Desks
descriptive_name "Floorsense Desk Tracking"
Expand Down Expand Up @@ -74,7 +74,7 @@ class Floorsense::Desks < ACAEngine::Driver
if response.success?
resp = AuthResponse.from_json(data)
token = resp.info.not_nil!.token
payload, header = JWT.decode(token, verify: false, validate: false)
payload, _ = JWT.decode(token, verify: false, validate: false)
@auth_expiry = (Time.unix payload["exp"].as_i64) - 5.minutes
@auth_token = "Bearer #{token}"
else
Expand Down
2 changes: 1 addition & 1 deletion drivers/gantner/relaxx/protocol_json.cr
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ require "set"
# User = Administrator
# PW = Mirone59

class Gantner::Relaxx::ProtocolJSON < ACAEngine::Driver
class Gantner::Relaxx::ProtocolJSON < PlaceOS::Driver
# Discovery Information
tcp_port 8237
descriptive_name "Gantner GAT Relaxx JSON API"
Expand Down
2 changes: 1 addition & 1 deletion drivers/helvar/net.cr
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module Helvar; end

# Documentation: https://aca.im/driver_docs/Helvar/HelvarNet-Overview.pdf

class Helvar::Net < ACAEngine::Driver
class Helvar::Net < PlaceOS::Driver
# Discovery Information
tcp_port 50000
descriptive_name "Helvar Net Lighting Gateway"
Expand Down
2 changes: 1 addition & 1 deletion drivers/helvar/net_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ EngineSpec.mock_driver "Helvar::Net" do
resp = exec(:get_current_preset, group: 20)
should_send(">V:2,C:109,G:20#")
responds("!V:2,C:109,G:20=1#")
expect_raises(ACAEngine::Driver::RemoteException, "invalid group index parameter for !V:2,C:109,G:20=1 (Abort)") do
expect_raises(PlaceOS::Driver::RemoteException, "invalid group index parameter for !V:2,C:109,G:20=1 (Abort)") do
resp.get
end
status[:last_error].should eq("invalid group index parameter for !V:2,C:109,G:20=1")
Expand Down
2 changes: 1 addition & 1 deletion drivers/lutron/lighting.cr
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ module Lutron; end
# Login: lutron
# Password: integration

class Lutron::Lighting < ACAEngine::Driver
class Lutron::Lighting < PlaceOS::Driver
# Discovery Information
tcp_port 23
descriptive_name "Lutron Lighting Gateway"
Expand Down
4 changes: 2 additions & 2 deletions drivers/message_media/sms.cr
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
module MessageMedia; end

# Documentation: https://developers.messagemedia.com/code/messages-api-documentation/
require "engine-driver/interface/sms"
require "driver/interface/sms"

class MessageMedia::SMS < ACAEngine::Driver
class MessageMedia::SMS < PlaceOS::Driver
include Interface::SMS

# Discovery Information
Expand Down
2 changes: 1 addition & 1 deletion drivers/office_rnd/office_rnd_api.cr
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ require "uuid"
require "./models"

module OfficeRnd
class OfficeRndAPI < ACAEngine::Driver
class OfficeRndAPI < PlaceOS::Driver
# Discovery Information
generic_name :OfficeRnd
descriptive_name "OfficeRnD REST API"
Expand Down
10 changes: 5 additions & 5 deletions drivers/panasonic/projector/nt_control.cr
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require "digest/md5"
require "engine-driver/interface/muteable"
require "engine-driver/interface/powerable"
require "engine-driver/interface/switchable"
require "driver/interface/muteable"
require "driver/interface/powerable"
require "driver/interface/switchable"

module Panasonic; end

Expand All @@ -18,7 +18,7 @@ module Panasonic::Projector; end
# 4. Projector responds with a value
# 5. You have to disconnect explicitly, projector won't close the connection

class Panasonic::Projector::NTControl < ACAEngine::Driver
class Panasonic::Projector::NTControl < PlaceOS::Driver
include Interface::Powerable
include Interface::Muteable

Expand All @@ -34,7 +34,7 @@ class Panasonic::Projector::NTControl < ACAEngine::Driver
Composite
end

include ACAEngine::Driver::Interface::InputSelection(Inputs)
include PlaceOS::Driver::Interface::InputSelection(Inputs)

# Discovery Information
tcp_port 1024
Expand Down
2 changes: 1 addition & 1 deletion drivers/point_grab/cogni_point.cr
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ module PointGrab; end

# Documentation: https://aca.im/driver_docs/PointGrab/CogniPointAPI2-1.pdf

class PointGrab::CogniPoint < ACAEngine::Driver
class PointGrab::CogniPoint < PlaceOS::Driver
# Discovery Information
generic_name :CogniPoint
descriptive_name "PointGrab CogniPoint REST API"
Expand Down
6 changes: 3 additions & 3 deletions drivers/screen_technics/connect.cr
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
module ScreenTechnics; end

require "engine-driver/interface/moveable"
require "engine-driver/interface/stoppable"
require "driver/interface/moveable"
require "driver/interface/stoppable"

# Documentation: https://aca.im/driver_docs/Screen%20Technics/Screen%20Technics%20IP%20Connect%20module.pdf
# Default user: Admin
# Default pass: Connect

class ScreenTechnics::Connect < ACAEngine::Driver
class ScreenTechnics::Connect < PlaceOS::Driver
include Interface::Moveable
include Interface::Stoppable

Expand Down
2 changes: 1 addition & 1 deletion drivers/screen_technics/connect_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ EngineSpec.mock_driver "ScreenTechnics::Connect" do
end

# Original down command should have failed
expect_raises(ACAEngine::Driver::RemoteException, "queue cleared (Abort)") do
expect_raises(PlaceOS::Driver::RemoteException, "queue cleared (Abort)") do
ret_val.get
end

Expand Down
4 changes: 2 additions & 2 deletions drivers/sony/camera/cgi_protocol.cr
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
require "engine-driver/interface/camera"
require "driver/interface/camera"

module Sony; end

module Sony::Camera; end

# Documentation: https://aca.im/driver_docs/Sony/sony-camera-CGI-Commands-1.pdf

class Sony::Camera::CGI < ACAEngine::Driver
class Sony::Camera::CGI < PlaceOS::Driver
# include Interface::Powerable
include Interface::Camera

Expand Down
2 changes: 1 addition & 1 deletion drivers/sony/camera/cgi_protocol_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ EngineSpec.mock_driver "Floorsense::Desks" do
retval = exec(:query_status)

# We should request a new token from Floorsense
expect_http_request do |request, response|
expect_http_request do |_request, response|
response.status_code = 200
response.output.puts %(AbsolutePTZF=15400,fd578,0000,cb5a&PanMovementRange=eac00,15400&PanPanoramaRange=de00,2200&PanTiltMaxVelocity=24&PtzInstance=1&TiltMovementRange=fc400,b400&TiltPanoramaRange=fc00,1200&ZoomMaxVelocity=8&ZoomMovementRange=0000,4000,7ac0&PtzfStatus=idle,idle,idle,idle&AbsoluteZoom=609)
end
Expand Down
6 changes: 3 additions & 3 deletions shard.lock
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ shards:
github: drujensen/delimiter_tree
version: 0.1.4

engine-driver:
github: aca-labs/crystal-engine-driver
commit: c983a7c4b7e50942358617c4e31c0e9e291912e0
driver:
github: placeos/driver
commit: 25f596a36cf291f489e5df0c3f862a40670a12f8

etcd:
github: aca-labs/crystal-etcd
Expand Down
8 changes: 4 additions & 4 deletions shard.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
name: engine-drivers
name: drivers
version: 1.0.0

# compile target
targets:
engine-drivers:
test-harness:
main: src/app.cr

dependencies:
action-controller:
github: spider-gazelle/action-controller
version: ~> 2.0

engine-driver:
github: aca-labs/crystal-engine-driver
driver:
github: placeos/driver
branch: master

exec_from:
Expand Down
Loading

0 comments on commit 984d396

Please sign in to comment.