/// <summary> /// Default constructor /// </summary> public HeaderPacketComm() { m_command = Command.NONE; m_statusComm = StatusServer.NORMAL; m_idResponse = 0; m_size = 0; }
/// <summary> /// API. Мобильное устройство обращается по этому адресу и получает Json. /// </summary> /// <returns></returns> public JsonResult GetInfo() { var statusServer = new StatusServer() { DateTime = ServerReglament.CountServerReglament(), Status = ServerReglament.Status }; return(Json(statusServer, JsonRequestBehavior.AllowGet)); }
/// <summary> /// Constructor that get the values from a buffer of bytes /// </summary> /// <param name="buffer"></param> public HeaderPacketComm(byte[] buffer) { // Create an array to obtain the values uint[] values = new uint[4]; // Copy the values in the buffer into the new created array Buffer.BlockCopy(buffer, 1, values, 0, SIZE_HEADER_PACKET - 1); // Set the values of the class m_command = (Command)values[0]; m_statusComm = (StatusServer)values[1]; m_idResponse = values[2]; m_size = values[3]; }