66 lines
1.6 KiB
C#
66 lines
1.6 KiB
C#
|
|
using MQTTServerSideAPI.Models;
|
|||
|
|
using Newtonsoft.Json.Linq;
|
|||
|
|
using System;
|
|||
|
|
using System.Collections.Generic;
|
|||
|
|
using System.Linq;
|
|||
|
|
using System.Net;
|
|||
|
|
using System.Net.Http;
|
|||
|
|
using System.Web.Helpers;
|
|||
|
|
using System.Web.Http;
|
|||
|
|
using System.Xml.Linq;
|
|||
|
|
|
|||
|
|
namespace MQTTServerSideAPI.Controllers
|
|||
|
|
{
|
|||
|
|
public class StateController : ApiController
|
|||
|
|
{
|
|||
|
|
public IEnumerable<string> Get()
|
|||
|
|
{
|
|||
|
|
return new string[] { "value1", "value2" };
|
|||
|
|
}
|
|||
|
|
// GET: api/State
|
|||
|
|
public List<string> Get(string devicename,string stime,string etime)
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
return SQLiteDBHelper.GetSelectStatus(devicename, stime, etime);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// GET: api/State/5
|
|||
|
|
public List<string> Get(string productid, string devicename,string times, string Statuss)
|
|||
|
|
{
|
|||
|
|
return SQLiteDBHelper.GetSelectStatus(productid, devicename, times, Statuss);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public List<string> Get(string productid, string devicename)
|
|||
|
|
{
|
|||
|
|
return SQLiteDBHelper.GetSelectStatus(productid, devicename);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//public StateByecharts Get(string devicename)
|
|||
|
|
//{
|
|||
|
|
|
|||
|
|
// return SQLiteDBHelper.GetSelectStatus(devicename); ;
|
|||
|
|
//}
|
|||
|
|
|
|||
|
|
// POST: api/State
|
|||
|
|
public void Post([FromBody] JObject mqttmessage)
|
|||
|
|
{
|
|||
|
|
//Logger.LogCalloutanaSide("StateController:" + mqttmessage);
|
|||
|
|
|
|||
|
|
|
|||
|
|
SQLiteDBHelper.InsertState(mqttmessage);
|
|||
|
|
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// PUT: api/State/5
|
|||
|
|
public void Put(int id, [FromBody]string value)
|
|||
|
|
{
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// DELETE: api/State/5
|
|||
|
|
public void Delete(int id)
|
|||
|
|
{
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|