1
0
Fork 0
mirror of https://codeberg.org/Mercury-IM/Smack synced 2024-11-26 08:12:05 +01:00

Merge pull request #208 from fuentesj11/documentation-review

Proofread Getting Started documentation
This commit is contained in:
Florian Schmaus 2018-03-04 17:21:46 +01:00 committed by GitHub
commit 2e4ce965cd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 13 deletions

View file

@ -1,7 +1,7 @@
Internet of Things (XEP-0323, -0324, -0325, -0347) Internet of Things (XEP-0323, -0324, -0325, -0347)
================================================== ==================================================
The Internet of Things (IoT) XEPs are an experimental open standard how XMPP can be used for IoT. They currently consists of The Internet of Things (IoT) XEPs are an experimental open standard on how XMPP can be used for IoT. They currently consist of
- XEP-0323 Sensor Data - XEP-0323 Sensor Data
- XEP-0324 Provisioning - XEP-0324 Provisioning
- XEP-0325 Control - XEP-0325 Control
@ -13,7 +13,7 @@ Smack only supports a subset of the functionality described by the XEPs!
Thing Builder Thing Builder
------------- -------------
The `org.jivesoftware.smackx.iot.Thing` class acts as basic entity representing a single "Thing" which can used to retrieve data from or to send control commands to. `Things` are constructed using a builder API. The `org.jivesoftware.smackx.iot.Thing` class acts as basic entity representing a single "Thing" which can be used to retrieve data from or to send control commands to. `Things` are constructed using a builder API.
Reading data from things Reading data from things
@ -32,9 +32,9 @@ Thing dataThing = Thing.builder().setKey(key).setSerialNumber(sn).setMomentaryRe
}).build(); }).build();
``` ```
While not strictly required, most things are identified via a key and serial number. We also build the thing with a "momentary read out request handler" which when triggered, retrieved the current temperature and reports it back to the requestor. While not strictly required, most things are identified via a key and serial number. We also build the thing with a "momentary read out request handler" which when triggered, retrieves the current temperature and reports it back to the requestor.
After the `Thing` is build, it needs to be made available so that other entities within the federated XMPP network can use it. Right now, we only intall the Thing in the `IoTDataManager`, which means the thing will act on read out requests but not be managed by a provisioning server. After the `Thing` is built, it needs to be made available so that other entities within the federated XMPP network can use it. Right now we only install the Thing in the `IoTDataManager`, which means the thing will act on read out requests but not be managed by a provisioning server.
```java ```java
IoTDataManager iotDataManager = IoTDataManager.getInstanceFor(connection); IoTDataManager iotDataManager = IoTDataManager.getInstanceFor(connection);
@ -53,7 +53,7 @@ Now you have to unwrap the `IoTDataField` instances from the `IoTFieldsExtension
Controlling a thing Controlling a thing
------------------- -------------------
Things can also be controlled, e.g. to turn on a light. Let's create thing which can be used to turn the light on and off. Things can also be controlled, e.g. to turn on a light. Let's create a thing which can be used to turn the light on and off.
```java ```java
Thing controlThing = Thing.builder().setKey(key).setSerialNumber(sn).setControlRequestHandler(new ThingControlRequest() { Thing controlThing = Thing.builder().setKey(key).setSerialNumber(sn).setControlRequestHandler(new ThingControlRequest() {
@ -69,7 +69,7 @@ Thing controlThing = Thing.builder().setKey(key).setSerialNumber(sn).setControlR
}).build(); }).build();
``` ```
No we have to install this thing into the `IoTControlManager`: Now we have to install this thing into the `IoTControlManager`:
```java ```java
IoTControlManager iotControlManager = IoTControlManager.getInstanceFor(connection); IoTControlManager iotControlManager = IoTControlManager.getInstanceFor(connection);
@ -89,9 +89,9 @@ Smack currently only supports a subset of the possible data types for set data.
Discovery Discovery
--------- ---------
You may wondered how a full JIDs of things can be determined. One approach is using the discovery mechanisms specified in XEP-0347. Smack provides the `IoTDiscoveryManager` as API for this. You may have wondered how a full JIDs of things can be determined. One approach is using the discovery mechanisms specified in XEP-0347. Smack provides the `IoTDiscoveryManager` as an API for this.
For example, instead of just installing the previous things in the `IoTDataManager` and/or `IoTControlManager`, we could also use the `IoTDiscoveryManger` to register the thing with a registry. Doing thing also installs the thing in the `IoTDataManager` and the `IoTControlManager`. For example, instead of just installing the previous things in the `IoTDataManager` and/or `IoTControlManager`, we could also use the `IoTDiscoveryManger` to register the thing with a registry. Doing this also installs the thing in the `IoTDataManager` and the `IoTControlManager`.
```java ```java
IoTDiscoveryManager iotDiscoveryManager = IoTDiscoveryManager.getInstanceFor(connection); IoTDiscoveryManager iotDiscoveryManager = IoTDiscoveryManager.getInstanceFor(connection);
@ -105,7 +105,7 @@ The `IoTDiscoveryManager` can also be used to claim, disown, remove and unregist
Provisioning Provisioning
------------ ------------
Things can usually only be used by other things if they are friends. Since a thing normally can't decide on its own if an incoming friendship request should be granted or not, we can delegate this decission to a provisioning service. Smack provides the `IoTProvisinoManager` to deal with friendship and provisioning. Things can usually only be used by other things if they are friends. Since a thing normally can't decide on its own if an incoming friendship request should be granted or not, we can delegate this decision to a provisioning service. Smack provides the `IoTProvisinoManager` to deal with friendship and provisioning.
For example, if you want to befriend another thing: For example, if you want to befriend another thing:

View file

@ -10,11 +10,11 @@ Smack Modules and Requirements
------------------------------- -------------------------------
Smack is meant to be easily embedded into any existing Java application. The Smack is meant to be easily embedded into any existing Java application. The
library ships as several modulesto provide more flexibility over which library ships as several modules to provide more flexibility over which
features applications require: features applications require:
* `smack-core` -- provides core XMPP functionality. All XMPP features that are part of the XMPP RFCs are included. * `smack-core` -- provides core XMPP functionality. All XMPP features that are part of the XMPP RFCs are included.
* `smack-im` -- provides functinoality defined in RFC 6121 (XMPP-IM), like the Roster. * `smack-im` -- provides functionality defined in RFC 6121 (XMPP-IM), like the Roster.
* `smack-tcp` -- support for XMPP over TCP. Includes XMPPTCPConnection class, which you usually want to use * `smack-tcp` -- support for XMPP over TCP. Includes XMPPTCPConnection class, which you usually want to use
* `smack-extensions` -- support for many of the extensions (XEPs) defined by the XMPP Standards Foundation, including multi-user chat, file transfer, user search, etc. The extensions are documented in the [extensions manual](extensions/index.md). * `smack-extensions` -- support for many of the extensions (XEPs) defined by the XMPP Standards Foundation, including multi-user chat, file transfer, user search, etc. The extensions are documented in the [extensions manual](extensions/index.md).
* `smack-experimental` -- support for experimental extensions (XEPs) defined by the XMPP Standards Foundation. The API and functionality of those extensions should be considered as unstable. * `smack-experimental` -- support for experimental extensions (XEPs) defined by the XMPP Standards Foundation. The API and functionality of those extensions should be considered as unstable.
@ -30,7 +30,7 @@ Configuration
Smack has an initialization process that involves 2 phases. Smack has an initialization process that involves 2 phases.
* Initializing system properties - Initializing all the system properties accessible through the class **SmackConfiguration**. These properties are retrieve by the _getXXX_ methods on that class. * Initializing system properties - Initializing all the system properties accessible through the class **SmackConfiguration**. These properties are retrieved by the _getXXX_ methods on that class.
* Initializing startup classes - Initializing any classes meant to be active at startup by instantiating the class, and then calling the _initialize_ method on that class if it extends **SmackInitializer**. If it does not extend this interface, then initialization will have to take place in a static block of code which is automatically executed when the class is loaded. * Initializing startup classes - Initializing any classes meant to be active at startup by instantiating the class, and then calling the _initialize_ method on that class if it extends **SmackInitializer**. If it does not extend this interface, then initialization will have to take place in a static block of code which is automatically executed when the class is loaded.
Initialization is accomplished via a configuration file. By default, Smack Initialization is accomplished via a configuration file. By default, Smack
@ -73,7 +73,7 @@ created, such as the ability to disable or require encryption. See
[XMPPConnection Management](connections.md) for full details. [XMPPConnection Management](connections.md) for full details.
Once you've created a connection, you should login with the Once you've created a connection, you should login with the
`XMPPConnection.login()` method. Once you've logged in, you can being `XMPPConnection.login()` method. Once you've logged in, you can begin
chatting with other users by creating new `Chat` or `MultiUserChat` chatting with other users by creating new `Chat` or `MultiUserChat`
objects. objects.