Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 62 additions & 0 deletions documentation/PCPChannel.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
## The PCP Interface

This document describes how the __PCP Interface__ works and what its API is.

### Introduction
The PCP stands for the Personal Control Panel and can be considered the GPIIs main place for displaying messages to the user as well as providing the user with a place to adjust some of their settings, along with other useful controls

The PCP Interface can be connected to via the web socket: `http://localhost:8081/pcpChannel` and its API provide functionality for:
* Notifying when a user is logging in and logging out
* Sending a list of desired adjusters to the PCP
* Sending messages to be displayed in the PCP
* Receiving responses to messages from PCP

Message types:
(Info<- default), Error, Warning
{
type: "infoMessage",
message: "Howdy user! This is a message to you"
}

### Internal API

The PCPChannel is a component of the Flowmanager, used in the local/hybrid deployment on the local device. Its 3 main invokers are:
* `sendUserMessage`: This will send a message to be displayed in the PCP and takes a 'message' and a 'messageType' argument.
* **message** A string to display to the user
* **messageType** (optional) should be either "infoMessage", "warningMessage" or "errorMessage" - and will default to "infoMessage" if no second argument is given.
* `notifyLogin`: Should be called when notifying the PCP of a new user login. It takes two arguments; userToken and adjusters:
* **userToken** should be the token of the user logging in
* **adjusters** (optional) An object of the adjusters to display as keys and the value to show for the given adjuster as value. Will default to `{ "http://registry.gpii.net/common/highContrastEnabled": false }`
* `notifyLogout`: Should be called when notifying the PCP of a user logout. Does not take any arguments


### External API


#### Connection

Connection to the PCP is done as a WebSockets connection to the URL `/pcpChannel`.


#### On login [`login` message]:

When a user logs into the GPII system, it will emit a `login` message to the PCP client. The body of this will be a JSON object with a key `userToken` for the userToken of the user logging in, and a `settings` key with the adjusters to be displayed. An example of a `settings` value is: `{ "http://registry.gpii.net/common/highContrastEnabled": false }`


#### On logout [`logout` message]

When a user logs out of the GPII system, it will emit a `logout` message to the PCP client.


#### Sending user messages [`message` message]

When the GPII system has a message that it wants the PCP client to display, the system will emit a `message` message. It will have the format:

```
{
"type": "infoMessage",
"message": "My message"
}
```

Where the `"type"` can be either "infoMessage", "warningMessage" or "errorMessage", and `"message"` will contain the message to be displayed.
11 changes: 11 additions & 0 deletions gpii/node_modules/flowManager/src/FlowManager.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions gpii/node_modules/flowManager/src/FlowManagerUtilities.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

130 changes: 130 additions & 0 deletions gpii/node_modules/flowManager/src/PCPInterface.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

69 changes: 51 additions & 18 deletions gpii/node_modules/flowManager/src/UserLogonStateChange.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading