Update CONTRIBUTING.md

dependabot/npm_and_yarn/Src/WebController/UI/websocket-extensions-0.1.4
ja256 2019-09-03 11:54:39 +02:00 committed by GitHub
parent 42b284e114
commit 0f8a7686a3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 0 deletions

View File

@ -213,11 +213,15 @@ ByteVector TestCommand(ByteView args)
The `TestCommand` method adds a debug text entry to C3s *Log*. `DebugInformation` is used which is rendered in a Relays console window only when compiled in debug mode. The message consists of two elements: a hard-coded text "Custom Command : " and a string that is provided by a user in the UI. Note the use of the `OBF` macro, this is used to encrypt strings at compile-time, which are decrypted at run-time only when required. Also of note is that the `TestCommand` handler returns an empty `MWR::ByteVector` as theres nothing to send back to the Gateway.
**Note:** The `GetCapability` method is compiled only when building Gateways executable and therefor its not required to use the `OBF` macro to obfuscate its strings.
After rebuilding the solution once again and launching C3 the Test Command becomes available in `MyChannels` Command Center:
![C3](Res/ContributionGuide/11.png)
![C3](Res/ContributionGuide/12.png)
**Note:** C3 can be launched in a debug mode by running `dotnet run -c Debug` console command from the *Src/WebController/Backend* location. Debug mode enables Node Relays console window, allowing to read their local C3 *Log*.
### Putting it all Together
After developing a functionally working channel, the next stage is to refactor the code. The `MyChannel` type is still quite small, but for larger classes its common to split the implementation between a header and a compilation unit file. For `MyChannel` this involves adding a new *MyChannel.h* file in the same location as *MyChannel.cpp*. This also involves embracing the channel with the appropriate namespace declaration - `MWR::C3::Interfaces::Channels`. Finally, doxygen-style documentation is added to improve readability. *MyChannel.h* is then as such: