23 changed files with 363 additions and 66 deletions
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -0,0 +1,24 @@ |
|||
/** |
|||
* Copyright © 2016-2022 The Thingsboard Authors |
|||
* |
|||
* Licensed under the Apache License, Version 2.0 (the "License"); |
|||
* you may not use this file except in compliance with the License. |
|||
* You may obtain a copy of the License at |
|||
* |
|||
* http://www.apache.org/licenses/LICENSE-2.0
|
|||
* |
|||
* Unless required by applicable law or agreed to in writing, software |
|||
* distributed under the License is distributed on an "AS IS" BASIS, |
|||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|||
* See the License for the specific language governing permissions and |
|||
* limitations under the License. |
|||
*/ |
|||
package org.thingsboard.server.controller.plugin; |
|||
|
|||
public interface TbWebSocketMsg<T> { |
|||
|
|||
TbWebSocketMsgType getType(); |
|||
|
|||
T getMsg(); |
|||
|
|||
} |
|||
@ -0,0 +1,21 @@ |
|||
/** |
|||
* Copyright © 2016-2022 The Thingsboard Authors |
|||
* |
|||
* Licensed under the Apache License, Version 2.0 (the "License"); |
|||
* you may not use this file except in compliance with the License. |
|||
* You may obtain a copy of the License at |
|||
* |
|||
* http://www.apache.org/licenses/LICENSE-2.0
|
|||
* |
|||
* Unless required by applicable law or agreed to in writing, software |
|||
* distributed under the License is distributed on an "AS IS" BASIS, |
|||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|||
* See the License for the specific language governing permissions and |
|||
* limitations under the License. |
|||
*/ |
|||
package org.thingsboard.server.controller.plugin; |
|||
|
|||
public enum TbWebSocketMsgType { |
|||
|
|||
PING, TEXT |
|||
} |
|||
@ -0,0 +1,38 @@ |
|||
/** |
|||
* Copyright © 2016-2022 The Thingsboard Authors |
|||
* |
|||
* Licensed under the Apache License, Version 2.0 (the "License"); |
|||
* you may not use this file except in compliance with the License. |
|||
* You may obtain a copy of the License at |
|||
* |
|||
* http://www.apache.org/licenses/LICENSE-2.0
|
|||
* |
|||
* Unless required by applicable law or agreed to in writing, software |
|||
* distributed under the License is distributed on an "AS IS" BASIS, |
|||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|||
* See the License for the specific language governing permissions and |
|||
* limitations under the License. |
|||
*/ |
|||
package org.thingsboard.server.controller.plugin; |
|||
|
|||
import lombok.RequiredArgsConstructor; |
|||
|
|||
import java.nio.ByteBuffer; |
|||
|
|||
@RequiredArgsConstructor |
|||
public class TbWebSocketPingMsg implements TbWebSocketMsg<ByteBuffer> { |
|||
|
|||
public static TbWebSocketPingMsg INSTANCE = new TbWebSocketPingMsg(); |
|||
|
|||
private static final ByteBuffer PING_MSG = ByteBuffer.wrap(new byte[]{}); |
|||
|
|||
@Override |
|||
public TbWebSocketMsgType getType() { |
|||
return TbWebSocketMsgType.PING; |
|||
} |
|||
|
|||
@Override |
|||
public ByteBuffer getMsg() { |
|||
return PING_MSG; |
|||
} |
|||
} |
|||
@ -0,0 +1,34 @@ |
|||
/** |
|||
* Copyright © 2016-2022 The Thingsboard Authors |
|||
* |
|||
* Licensed under the Apache License, Version 2.0 (the "License"); |
|||
* you may not use this file except in compliance with the License. |
|||
* You may obtain a copy of the License at |
|||
* |
|||
* http://www.apache.org/licenses/LICENSE-2.0
|
|||
* |
|||
* Unless required by applicable law or agreed to in writing, software |
|||
* distributed under the License is distributed on an "AS IS" BASIS, |
|||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|||
* See the License for the specific language governing permissions and |
|||
* limitations under the License. |
|||
*/ |
|||
package org.thingsboard.server.controller.plugin; |
|||
|
|||
import lombok.RequiredArgsConstructor; |
|||
|
|||
@RequiredArgsConstructor |
|||
public class TbWebSocketTextMsg implements TbWebSocketMsg<String> { |
|||
|
|||
private final String value; |
|||
|
|||
@Override |
|||
public TbWebSocketMsgType getType() { |
|||
return TbWebSocketMsgType.TEXT; |
|||
} |
|||
|
|||
@Override |
|||
public String getMsg() { |
|||
return value; |
|||
} |
|||
} |
|||
@ -0,0 +1,30 @@ |
|||
## Pull Request description |
|||
|
|||
Put your PR description here instead of this sentence. |
|||
|
|||
## General checklist |
|||
|
|||
- [ ] You have reviewed the guidelines [document](https://docs.google.com/document/d/1wqcOafLx5hth8SAg4dqV_LV3un3m5WYR8RdTJ4MbbUM/edit?usp=sharing). |
|||
- [ ] PR name contains fix version. For example, "[3.3.4] Hotfix of some UI component" or "[3.4] New Super Feature". |
|||
- [ ] Description references specific [issue](https://github.com/thingsboard/thingsboard/issues). |
|||
- [ ] Description contains human-readable scope of changes. |
|||
- [ ] Description contains brief notes about what needs to be added to the documentation. |
|||
- [ ] No merge conficts, commented blocks of code, code formatting issues. |
|||
- [ ] Changes are backward compatible or upgrade script is provided. |
|||
- [ ] Similar PR is opened for PE version to simplify merge. Required for internal contributors only. |
|||
|
|||
## Front-End feature checklist |
|||
|
|||
- [ ] Screenshots with affected component(s) are added. The best option is to provide 2 screens: before and after changes; |
|||
- [ ] If you change widget or other API, ensure it is backward-compatible or upgrade script is present. |
|||
- [ ] Ensure new API is documented [here](https://github.com/thingsboard/thingsboard-ui-help) |
|||
|
|||
## Back-End feature checklist |
|||
|
|||
- [ ] Added corresponding unit and/or integration test(s). Provide written explanation in the PR description if you have failed to add tests. |
|||
- [ ] If new dependency was added: the dependency tree is checked for conflicts. |
|||
- [ ] If new service was added: the service is marked with corresponding @TbCoreComponent, @TbRuleEngineComponent, @TbTransportComponent, etc. |
|||
- [ ] If new REST API was added: the RestClient.java was updated, issue for [Python REST client](https://github.com/thingsboard/thingsboard-python-rest-client) is created. |
|||
|
|||
|
|||
|
|||
File diff suppressed because one or more lines are too long
Loading…
Reference in new issue