1234567891011121314151617181920212223242526272829303132333435363738 |
-
- using SuperSocket.SocketBase.Protocol;
- using SuperWebSocket.SubProtocol;
- namespace OCPPServer.SubProtocol
- {
- public class OCPPSubCommandParser : IRequestInfoParser<SubRequestInfo>
- {
- #region ISubProtocolCommandParser Members
- /// <summary>
- /// Parses the request info.
- /// </summary>
- /// <param name="source">The source.</param>
- /// <returns></returns>
- public SubRequestInfo ParseRequestInfo(string source)
- {
- var cmd = source.Trim();
- int pos = cmd.IndexOf(',');
- string name;
- if (pos > 0)
- {
- name = cmd.Substring(pos - 1, 1);
- }
- else
- {
- name = "4";
- }
- return new SubRequestInfo(name, "", source);
- }
- #endregion ISubProtocolCommandParser Members
- }
- }
|