private void CreateRequest(GaiaPacket packet) { GaiaRequest request = new GaiaRequest(GaiaRequest.Type.SINGLE_REQUEST) { Packet = packet }; ProcessRequest(request); }
public async Task <IHttpActionResult> Post([FromBody] GaiaRequest gaiaRequest) { //byte[] bytes = System.IO.File.ReadAllBytes("C:\\Users\\dinowilliam\\Pictures\\Abellha_020.jpg"); //var str = System.Text.Encoding.Default.GetString(bytes); //var data = System.Convert.ToBase64String(bytes); var ImageBusiness = new ImageBusiness(); var image = new Image(); image.Name = gaiaRequest.NomeArquivo; image.ImageData = gaiaRequest.DataArquivo; ImageBusiness.ImageProcess(image); var gaiaResponse = new GaiaResponse(); return(Json(gaiaResponse)); }
private void ProcessRequest(GaiaRequest request) { switch (request.Request) { case GaiaRequest.Type.SINGLE_REQUEST: try { byte[] bytes = request.Packet.GetBytes(); SendGaiaCommandEndpoint(bytes); } catch (GaiaException e) { Debug.WriteLine(TAG + ":::Process Request Exception: " + e.Message); RefreshToast("Process Request failed"); } break; case GaiaRequest.Type.ACKNOWLEDGEMENT: break; case GaiaRequest.Type.UNACKNOWLEDGED_REQUEST: break; } }