From 52811719f7fa6d4159840dd4f85b89bbb64d0819 Mon Sep 17 00:00:00 2001 From: chunyexixiaoyu <834670833@qq.com> Date: Thu, 14 Jul 2022 10:32:19 +0800 Subject: [PATCH 1/8] update the README.md on this branch --- README.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/README.md b/README.md index 0e66973..b45a8bf 100644 --- a/README.md +++ b/README.md @@ -87,3 +87,14 @@ dns server #1: 223.5.5.5 WebNet 软件包使用需要文件系统和Lwip协议栈的支持。 +webnet.c 文件中注意以下定义,注意其他操作系统lwip协议栈的大小设置 + +``` +#ifdef ADD_RTTHREAD_FETURES +#if defined(RT_USING_LWIP) && (RT_LWIP_TCPTHREAD_STACKSIZE < 1408) +#error The lwIP tcpip thread stack size(RT_LWIP_TCPTHREAD_STACKSIZE) must more than 1408 +#endif +#endif +``` + +webnet文件夹为该分支的一个前端页面文件版本 -- 2.34.1 From 27df62c9de293e4b77fdf64bc095ff5bc03373b1 Mon Sep 17 00:00:00 2001 From: chunyexixiaoyu <834670833@qq.com> Date: Thu, 14 Jul 2022 10:33:20 +0800 Subject: [PATCH 2/8] 1.add webnet web files 2.add source files adapt to the web. 3.the branch is specific version --- module/wn_module_log.c | 5 +- samples/deviceinfoasp.c | 103 ++++++++++++++++ samples/deviceinfoasp.h | 39 +++++++ samples/index.html | 81 ------------- samples/index.shtml | 14 --- samples/netsetting.c | 214 ++++++++++++++++++++++++++++++++++ samples/netsetting.h | 80 +++++++++++++ samples/uploaddata.c | 119 +++++++++++++++++++ samples/uploaddata.h | 16 +++ samples/version.asp | 10 -- samples/wn_sample.c | 99 +++++----------- src/wn_module.c | 1 + webnet/chart.html | 153 ++++++++++++++++++++++++ webnet/css/layout.css | 131 +++++++++++++++++++++ webnet/deviceinfo.asp | 147 +++++++++++++++++++++++ webnet/index_origin.html | 29 +++++ webnet/js/Chart.bundle.min.js | 7 ++ webnet/logo/logo.png | Bin 0 -> 211042 bytes webnet/mqtt.html | 211 +++++++++++++++++++++++++++++++++ webnet/netsetting.html | 119 +++++++++++++++++++ webnet/privateProtocol.html | 194 ++++++++++++++++++++++++++++++ webnet/systemModify.html | 140 ++++++++++++++++++++++ webnet/tcp.html | 212 +++++++++++++++++++++++++++++++++ 23 files changed, 1945 insertions(+), 179 deletions(-) create mode 100644 samples/deviceinfoasp.c create mode 100644 samples/deviceinfoasp.h delete mode 100644 samples/index.html delete mode 100644 samples/index.shtml create mode 100644 samples/netsetting.c create mode 100644 samples/netsetting.h create mode 100644 samples/uploaddata.c create mode 100644 samples/uploaddata.h delete mode 100644 samples/version.asp create mode 100644 webnet/chart.html create mode 100644 webnet/css/layout.css create mode 100644 webnet/deviceinfo.asp create mode 100644 webnet/index_origin.html create mode 100644 webnet/js/Chart.bundle.min.js create mode 100644 webnet/logo/logo.png create mode 100644 webnet/mqtt.html create mode 100644 webnet/netsetting.html create mode 100644 webnet/privateProtocol.html create mode 100644 webnet/systemModify.html create mode 100644 webnet/tcp.html diff --git a/module/wn_module_log.c b/module/wn_module_log.c index a834805..3ce0ab9 100644 --- a/module/wn_module_log.c +++ b/module/wn_module_log.c @@ -85,8 +85,9 @@ int webnet_module_log(struct webnet_session* session, int event) } else if (event == WEBNET_EVENT_URI_POST) { - printf("physical url: %s", request->path); - printf(" mime type: %s", mime_get_type(request->path)); + + printf("event post uri physical url: %s", request->path); + printf("mime type: %s", mime_get_type(request->path)); } else if (event == WEBNET_EVENT_RSP_HEADER) { diff --git a/samples/deviceinfoasp.c b/samples/deviceinfoasp.c new file mode 100644 index 0000000..fce7cd8 --- /dev/null +++ b/samples/deviceinfoasp.c @@ -0,0 +1,103 @@ +#include "deviceinfoasp.h" +deviceinfo xidatong_deviceinfo = +{ + DEVICE_NUM_DEFUALT, + DEVICE_NAME_DEFUALT, + DEVICE_TYPE_DEFUALT, + DEVICE_SERIAL_DEFUALT, + RT_THREAD_KERNEL, + SYSTEM_VERSION, + WEB_VERSION +}; + +void deviceinfo_default() +{ + /* + 目前认为这个是不变的变量 + */ + //memset((char *)(&xidatong_deviceinfo),0,sizeof(xidatong_deviceinfo)); +} + + void asp_var_device_name(struct webnet_session* session) +{ + assert(session != NULL); + static const char *temp = "
%s"; + webnet_session_printf(session, temp, xidatong_deviceinfo.name); +} + + void asp_var_device_number(struct webnet_session* session) +{ + assert(session != NULL); + static const char *temp = "%d" ; + webnet_session_printf(session, temp,xidatong_deviceinfo.number); +} + + void asp_var_device_type(struct webnet_session* session) +{ + assert(session != NULL); + static const char *temp = "%s"; + webnet_session_printf(session, temp, xidatong_deviceinfo.type); +} + + + void asp_var_device_serial(struct webnet_session* session) +{ + assert(session != NULL); + static const char *temp = "%s"; + webnet_session_printf(session, temp, xidatong_deviceinfo.serial); +} + + void asp_var_os_type(struct webnet_session* session) +{ + assert(session != NULL); + static const char *temp = "%s"; + webnet_session_printf(session, temp, xidatong_deviceinfo.ostype); +} + void asp_var_web_version(struct webnet_session* session) +{ + assert(session != NULL); + static const char *temp = "%s"; + webnet_session_printf(session, temp,xidatong_deviceinfo.webversion); +} + + void asp_var_system_firmware(struct webnet_session* session) +{ + assert(session != NULL); + static const char *temp = "系统固件 %s=0&&!c||x<0&&c?o-p:o+p),{size:l,base:o,head:s,center:s+l/2}},calculateBarIndexPixels:function(t,e,n,i){var a="flex"===i.barThickness?function(t,e,n){var i,a=e.pixels,r=a[t],o=t>0?a[t-1]:null,s=t XD=vs#`*equ-VPaEuS`6{Z*?mypzPjK(`mR
zW@2KM`gVZC<0&&n.stroke()},draw:function(){var t=this._chart.ctx,e=this._view;if(0!==e.opacity){var n={width:e.width,height:e.height},i={x:e.x,y:e.y},a=Math.abs(e.opacity<.001)?0:e.opacity,r=e.title.length||e.beforeBody.length||e.body.length||e.afterBody.length||e.footer.length;this._options.enabled&&r&&(t.save(),t.globalAlpha=a,this.drawBackground(i,e,t,n),i.y+=e.yPadding,H.rtl.overrideTextDirection(t,e.textDirection),this.drawTitle(i,e,t),this.drawBody(i,e,t),this.drawFooter(i,e,t),H.rtl.restoreTextDirection(t,e.textDirection),t.restore())}},handleEvent:function(t){var e,n=this,i=n._options;return n._lastActive=n._lastActive||[],"mouseout"===t.type?n._active=[]:(n._active=n._chart.getElementsAtEventForMode(t,i.mode,i),i.reverse&&n._active.reverse()),(e=!H.arrayEquals(n._active,n._lastActive))&&(n._lastActive=n._active,(i.enabled||i.custom)&&(n._eventPosition={x:t.x,y:t.y},n.update(!0),n.pivot())),e}}),Ue=Ye,Ge=je;Ge.positioners=Ue;var qe=H.valueOrDefault;function Ze(){return H.merge({},[].slice.call(arguments),{merger:function(t,e,n,i){if("xAxes"===t||"yAxes"===t){var a,r,o,s=n[t].length;for(e[t]||(e[t]=[]),a=0;a=e[t].length&&e[t].push({}),!e[t][a].type||o.type&&o.type!==e[t][a].type?H.merge(e[t][a],[Re.getScaleDefaults(r),o]):H.merge(e[t][a],o)}else H._merger(t,e,n,i)}})}function $e(){return H.merge({},[].slice.call(arguments),{merger:function(t,e,n,i){var a=e[t]||{},r=n[t];"scales"===t?e[t]=Ze(a,r):"scale"===t?e[t]=H.merge(a,[Re.getScaleDefaults(r.type),r]):H._merger(t,e,n,i)}})}function Xe(t){var e=t.options;H.each(t.scales,(function(e){me.removeBox(t,e)})),e=$e(W.global,W[t.config.type],e),t.options=t.config.options=e,t.ensureScalesHaveIDs(),t.buildOrUpdateScales(),t.tooltip._options=e.tooltips,t.tooltip.initialize()}function Ke(t,e,n){var i,a=function(t){return t.id===i};do{i=e+n++}while(H.findIndex(t,a)>=0);return i}function Je(t){return"top"===t||"bottom"===t}function Qe(t,e){return function(n,i){return n[t]===i[t]?n[e]-i[e]:n[t]-i[t]}}W._set("global",{elements:{},events:["mousemove","mouseout","click","touchstart","touchmove"],hover:{onHover:null,mode:"nearest",intersect:!0,animationDuration:400},onClick:null,maintainAspectRatio:!0,responsive:!0,responsiveAnimationDuration:0});var tn=function(t,e){return this.construct(t,e),this};H.extend(tn.prototype,{construct:function(t,e){var n=this;e=function(t){var e=(t=t||{}).data=t.data||{};return e.datasets=e.datasets||[],e.labels=e.labels||[],t.options=$e(W.global,W[t.type],t.options||{}),t}(e);var i=Ie.acquireContext(t,e),a=i&&i.canvas,r=a&&a.height,o=a&&a.width;n.id=H.uid(),n.ctx=i,n.canvas=a,n.config=e,n.width=o,n.height=r,n.aspectRatio=r?o/r:null,n.options=e.options,n._bufferedRender=!1,n._layers=[],n.chart=n,n.controller=n,tn.instances[n.id]=n,Object.defineProperty(n,"data",{get:function(){return n.config.data},set:function(t){n.config.data=t}}),i&&a?(n.initialize(),n.update()):console.error("Failed to create chart: can't acquire context from the given item")},initialize:function(){var t=this;return Le.notify(t,"beforeInit"),H.retinaScale(t,t.options.devicePixelRatio),t.bindEvents(),t.options.responsive&&t.resize(!0),t.initToolTip(),Le.notify(t,"afterInit"),t},clear:function(){return H.canvas.clear(this),this},stop:function(){return J.cancelAnimation(this),this},resize:function(t){var e=this,n=e.options,i=e.canvas,a=n.maintainAspectRatio&&e.aspectRatio||null,r=Math.max(0,Math.floor(H.getMaximumWidth(i))),o=Math.max(0,Math.floor(a?r/a:H.getMaximumHeight(i)));if((e.width!==r||e.height!==o)&&(i.width=e.width=r,i.height=e.height=o,i.style.width=r+"px",i.style.height=o+"px",H.retinaScale(e,n.devicePixelRatio),!t)){var s={width:r,height:o};Le.notify(e,"resize",[s]),n.onResize&&n.onResize(e,s),e.stop(),e.update({duration:n.responsiveAnimationDuration})}},ensureScalesHaveIDs:function(){var t=this.options,e=t.scales||{},n=t.scale;H.each(e.xAxes,(function(t,n){t.id||(t.id=Ke(e.xAxes,"x-axis-",n))})),H.each(e.yAxes,(function(t,n){t.id||(t.id=Ke(e.yAxes,"y-axis-",n))})),n&&(n.id=n.id||"scale")},buildOrUpdateScales:function(){var t=this,e=t.options,n=t.scales||{},i=[],a=Object.keys(n).reduce((function(t,e){return t[e]=!1,t}),{});e.scales&&(i=i.concat((e.scales.xAxes||[]).map((function(t){return{options:t,dtype:"category",dposition:"bottom"}})),(e.scales.yAxes||[]).map((function(t){return{options:t,dtype:"linear",dposition:"left"}})))),e.scale&&i.push({options:e.scale,dtype:"radialLinear",isDefault:!0,dposition:"chartArea"}),H.each(i,(function(e){var i=e.options,r=i.id,o=qe(i.type,e.dtype);Je(i.position)!==Je(e.dposition)&&(i.position=e.dposition),a[r]=!0;var s=null;if(r in n&&n[r].type===o)(s=n[r]).options=i,s.ctx=t.ctx,s.chart=t;else{var l=Re.getScaleConstructor(o);if(!l)return;s=new l({id:r,type:o,options:i,ctx:t.ctx,chart:t}),n[s.id]=s}s.mergeTicksOptions(),e.isDefault&&(t.scale=s)})),H.each(a,(function(t,e){t||delete n[e]})),t.scales=n,Re.addScalesToLayout(this)},buildOrUpdateControllers:function(){var t,e,n=this,i=[],a=n.data.datasets;for(t=0,e=a.length;t=0;t--)e=i.getDistanceFromCenterForValue(r.ticks.reverse?i.min:i.max),n=i.getPointPosition(t,e),a.beginPath(),a.moveTo(i.xCenter,i.yCenter),a.lineTo(n.x,n.y),a.stroke();a.restore()}},_drawLabels:function(){var t=this,e=t.ctx,n=t.options.ticks;if(n.display){var i,a,r=t.getIndexAngle(0),o=H.options._parseFont(n),s=Yn(n.fontColor,W.global.defaultFontColor);e.save(),e.font=o.string,e.translate(t.xCenter,t.yCenter),e.rotate(r),e.textAlign="center",e.textBaseline="middle",H.each(t.ticks,(function(r,l){(0!==l||n.reverse)&&(i=t.getDistanceFromCenterForValue(t.ticksAsNumbers[l]),n.showLabelBackdrop&&(a=e.measureText(r).width,e.fillStyle=n.backdropColor,e.fillRect(-a/2-n.backdropPaddingX,-i-o.size/2-n.backdropPaddingY,a+2*n.backdropPaddingX,o.size+2*n.backdropPaddingY)),e.fillStyle=s,e.fillText(r,0,-i))})),e.restore()}},_drawTitle:H.noop}),$n=Vn;Zn._defaults=$n;var Xn=H._deprecated,Kn=H.options.resolve,Jn=H.valueOrDefault,Qn=Number.MIN_SAFE_INTEGER||-9007199254740991,ti=Number.MAX_SAFE_INTEGER||9007199254740991,ei={millisecond:{common:!0,size:1,steps:1e3},second:{common:!0,size:1e3,steps:60},minute:{common:!0,size:6e4,steps:60},hour:{common:!0,size:36e5,steps:24},day:{common:!0,size:864e5,steps:30},week:{common:!1,size:6048e5,steps:4},month:{common:!0,size:2628e6,steps:12},quarter:{common:!1,size:7884e6,steps:4},year:{common:!0,size:3154e7}},ni=Object.keys(ei);function ii(t,e){return t-e}function ai(t){return H.valueOrDefault(t.time.min,t.ticks.min)}function ri(t){return H.valueOrDefault(t.time.max,t.ticks.max)}function oi(t,e,n,i){var a=function(t,e,n){for(var i,a,r,o=0,s=t.length-1;o>=0&&o<=s;){if(a=t[(i=o+s>>1)-1]||null,r=t[i],!a)return{lo:null,hi:r};if(r[e]=0;--n)(e=l[n].$filler)&&e.visible&&(a=(i=e.el)._view,r=i._children||[],o=e.mapper,s=a.backgroundColor||W.global.defaultColor,o&&s&&r.length&&(H.canvas.clipArea(u,t.chartArea),ki(u,r,o,a,s,i._loop),H.canvas.unclipArea(u)))}},Si=H.rtl.getRtlAdapter,Di=H.noop,Ci=H.valueOrDefault;function Pi(t,e){return t.usePointStyle&&t.boxWidth>e?e:t.boxWidth}W._set("global",{legend:{display:!0,position:"top",align:"center",fullWidth:!0,reverse:!1,weight:1e3,onClick:function(t,e){var n=e.datasetIndex,i=this.chart,a=i.getDatasetMeta(n);a.hidden=null===a.hidden?!i.data.datasets[n].hidden:null,i.update()},onHover:null,onLeave:null,labels:{boxWidth:40,padding:10,generateLabels:function(t){var e=t.data.datasets,n=t.options.legend||{},i=n.labels&&n.labels.usePointStyle;return t._getSortedDatasetMetas().map((function(n){var a=n.controller.getStyle(i?0:void 0);return{text:e[n.index].label,fillStyle:a.backgroundColor,hidden:!t.isDatasetVisible(n.index),lineCap:a.borderCapStyle,lineDash:a.borderDash,lineDashOffset:a.borderDashOffset,lineJoin:a.borderJoinStyle,lineWidth:a.borderWidth,strokeStyle:a.borderColor,pointStyle:a.pointStyle,rotation:a.rotation,datasetIndex:n.index}}),this)}}},legendCallback:function(t){var e,n,i,a=document.createElement("ul"),r=t.data.datasets;for(a.setAttribute("class",t.id+"-legend"),e=0,n=r.length;e15ZEYmMWRVT7yxo}?}s>oIV&>>driC}K{;Cor2`Wj$N^Zxt`OFbt7Dug)Af)zi=HnL{KxUU
zK8I-Ee@b&1D^|x3O@2QAZS7mX&!mwxxHQg%7U+IOH
Jm$?(PE8R1NI7&Gm-H
6){YjvDQ8)gh3!>IP3Nsya+mqle8P77plHiR9IUys^xmyx?_F~=%
z=`U=N8FY2jG*X=fDsYagqJS$5-gtJ*$@s|$B_>$9CVdNbIP-PFakWD4QXuB1#$^(U
z|Mi*dt%qM-x~}ox0}OjwXxfB(4m6SSHdbkogB^DlCQEN{f^aXVj*;3n8s$bS99N
zB;$84%70Lh!ct&@znosf&ZNGmBq^&CIIm*<@>ab;rljmQGc(~y9*sDw`wzP$gf){n
z*x_YY_)(MV+u_hBa9IE6lJ4ro$o^=obKmZs9T*J7K+cwTK6_*@7M>0of7-QCLzWQP
zaC#{Hlpki{X|Kl&krA!KPNs;5P4%B3TT(E
peiO3>$opfwwbAlF;a#4B;uJLOK=
zGZ9!y%RmgK*5XekZyw^l)S{;D<&;s0<^E6%?S4f35t5upJkF6rpblh|ZU|VmW}T?VX+YaU?`<
zH~_z!#pYdVRZd4Chr@|R!a96OxdIWm