Skip to content

Commit

Permalink
1.7.4
Browse files Browse the repository at this point in the history
  • Loading branch information
bambooww committed Dec 12, 2024
1 parent 4d99014 commit e33026c
Show file tree
Hide file tree
Showing 42 changed files with 1,644 additions and 108 deletions.
2 changes: 1 addition & 1 deletion core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>org.iottree</groupId>
<artifactId>iottree-parent</artifactId>
<version>1.7.3</version>
<version>1.7.4</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
3 changes: 2 additions & 1 deletion core/src/main/java/org/iottree/core/ConnPt.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import java.util.LinkedList;
import java.util.List;

import org.iottree.core.cxt.JSObMap;
import org.iottree.core.util.CompressUUID;
import org.iottree.core.util.Convert;
import org.iottree.core.util.xmldata.IXmlDataValidator;
Expand All @@ -20,7 +21,7 @@
* @author jason.zhu
*
*/
public abstract class ConnPt implements IXmlDataValidator
public abstract class ConnPt extends JSObMap implements IXmlDataValidator
{
private static int cc = 0 ;
private static long last_id_dt = -1 ;
Expand Down
20 changes: 17 additions & 3 deletions core/src/main/java/org/iottree/core/UACh.java
Original file line number Diff line number Diff line change
Expand Up @@ -592,6 +592,15 @@ public boolean delFromParent() throws Exception
* 1��node��s self prop group
* 2) driver's group
*/

public static final String PG_DRV_SPC_CONF = "ch_drv_spc_conf" ;
public static final String PI_DRV_CONF = "ch_drv_conf" ;

public String getDrvSpcConfigTxt()
{
return (String)getPropValue(PG_DRV_SPC_CONF,PI_DRV_CONF);
}

@Override
public List<PropGroup> listPropGroups()
{
Expand All @@ -609,8 +618,8 @@ public List<PropGroup> listPropGroups()
if(uad.hasDriverConfigPage())
{
Lan lan = Lan.getPropLangInPk(this.getClass()) ;
PropGroup gp = new PropGroup("ch_drv_spc_conf",lan);//"Timing");;
gp.addPropItem(new PropItem("ch_drv_conf",lan,PValTP.vt_str,false,null,null,"")
PropGroup gp = new PropGroup(PG_DRV_SPC_CONF,lan);//"Timing");;
gp.addPropItem(new PropItem(PI_DRV_CONF,lan,PValTP.vt_str,false,null,null,"")
.withPop("drv_spc")
);
pgs.add(gp) ;
Expand Down Expand Up @@ -824,7 +833,12 @@ public boolean RT_startDriver(StringBuilder failedr) throws Exception
}

//finally
return drv.RT_start(failedr) ;
boolean ret = drv.RT_start(failedr) ;
if(!ret)
{

}
return ret ;
}

public boolean RT_stopDriver(boolean bforce)
Expand Down
22 changes: 17 additions & 5 deletions core/src/main/java/org/iottree/core/UANodeOCTags.java
Original file line number Diff line number Diff line change
Expand Up @@ -568,6 +568,11 @@ public UATag addTag(DevItem item) throws Exception
}

public UATag addTag(String name,String title,String desc,UAVal.ValTP vt,boolean bsave) throws Exception
{
return addTag(name,title,desc,vt,false,bsave);
}

public UATag addTag(String name,String title,String desc,UAVal.ValTP vt,boolean canwrite,boolean bsave) throws Exception
{
UAUtil.assertUAName(name);
UANode tmpn = getSubNodeByName(name);
Expand All @@ -581,15 +586,22 @@ public UATag addTag(String name,String title,String desc,UAVal.ValTP vt,boolean

UATag d = new UATag(name,title,desc,null,vt,0,false,200);
d.id = this.getNextIdByRoot();
d.bCanWrite = canwrite;
tags.add(d);
constructNodeTree();
this.bDirty = true ;
this.clearJsNames();
if(bsave)
save();
return d;
}

public UATag getOrAddTag(String name,String title,String desc,UAVal.ValTP vt,boolean bsave) throws Exception
{
return getOrAddTag(name,title,desc,vt,false,bsave) ;
}

public UATag getOrAddTag(String name,String title,String desc,UAVal.ValTP vt,boolean canwrite,boolean bsave) throws Exception
{
UANode tmpn = this.getSubNodeByName(name) ;
if(tmpn!=null)
Expand All @@ -600,16 +612,16 @@ public UATag getOrAddTag(String name,String title,String desc,UAVal.ValTP vt,boo
return (UATag)tmpn ;
}

return addTag(name,title,desc,vt,bsave) ;
return addTag(name,title,desc,vt,canwrite,bsave) ;
}

@JsDef
private UATag get_add_tag(String name,String title,String desc,String vtstr,boolean bsave) throws Exception
@JsDef(method_params_title="name,title,description,val tp str,canwrite,bsave")
private UATag get_add_tag(String name,String title,String desc,String vtstr,boolean canwrite,boolean bsave) throws Exception
{
UAVal.ValTP vt = UAVal.getValTp(vtstr) ;
if(vt==null)
throw new IllegalArgumentException("unknown vt "+vtstr) ;
return getOrAddTag(name,title,desc, vt,bsave) ;
return getOrAddTag(name,title,desc, vt,canwrite,bsave) ;
}

public boolean delTag(UATag t) throws Exception
Expand Down Expand Up @@ -1032,7 +1044,7 @@ protected void RT_flush()
{

}

final void RT_runFlush()
{
this.RT_flush();
Expand Down
29 changes: 27 additions & 2 deletions core/src/main/java/org/iottree/core/UAPrj.java
Original file line number Diff line number Diff line change
Expand Up @@ -1472,7 +1472,7 @@ public void run()

if(!b_station_ins)
{
RT_runFlush();
runFlush();
runMidTagsScript();
runScriptInterval();
runShareInterval();
Expand Down Expand Up @@ -1517,7 +1517,7 @@ public void run()

stopPrj();

RT_runFlush();
runFlush();

AlertManager.getInstance(UAPrj.this.getId()).RT_stop();

Expand Down Expand Up @@ -1562,6 +1562,31 @@ public PrjSharer getSharer()
{
return PrjShareManager.getInstance().getSharer(this.getId());
}

private transient long lastRunFlush = -1 ;

final void runFlush()
{
if(System.currentTimeMillis()-lastRunFlush<500)
return ;

try
{
this.RT_runFlush();
for (UANode subn : this.getSubNodes())
{
if (subn instanceof UANodeOCTags)
{
((UANodeOCTags) subn).RT_runFlush();
}
}
}
finally
{
lastRunFlush = System.currentTimeMillis() ;
}
}


private void runShareInterval()
{
Expand Down
8 changes: 6 additions & 2 deletions core/src/main/java/org/iottree/core/UATag.java
Original file line number Diff line number Diff line change
Expand Up @@ -1192,7 +1192,10 @@ UAVal CXT_calMidVal()
//this.RT_set
return null;
}
//long st = System.currentTimeMillis() ;
//long stn = System.nanoTime() ;
Object ob = ci.runCode() ;
//System.out.println("cost="+(System.currentTimeMillis()-st)+" nano="+(System.nanoTime()-stn)) ;
return this.RT_setValRaw(ob);
//v.setVal(true, ob, System.currentTimeMillis());

Expand Down Expand Up @@ -1537,8 +1540,9 @@ private boolean RT_writeValDriver(Object v)

StringBuilder sb = new StringBuilder() ;
DevAddr da = this.getDevAddr(sb);
if(da==null)
return false;
//if(da==null)
// return false;

UACh ch = this.getBelongToCh() ;
if(ch==null)
return false; //must has channel
Expand Down
60 changes: 57 additions & 3 deletions core/src/main/java/org/iottree/core/conn/ConnProUDP.java
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
package org.iottree.core.conn;

import java.util.List;

import org.iottree.core.ConnProvider;
import org.iottree.core.ConnPt;

public class ConnProUDP extends ConnProvider
{
public static final String TP ="udp" ;
public static final String TP ="udp_msg" ;


@Override
Expand All @@ -17,7 +19,7 @@ public String getProviderType()
@Override
public String getProviderTpt()
{
return "UDP" ;
return "UDP Msg" ;
}

@Override
Expand All @@ -39,10 +41,62 @@ protected long connpRunInterval()
{
return 1000;
}

public void start() throws Exception
{
List<ConnPt> pts = this.listConns() ;
if(pts==null||pts.size()<=0)
return ;

super.start();

for(ConnPt ci:pts)
{
if(!ci.isEnable())
continue ;
try
{
ConnPtUDPMsg conn = (ConnPtUDPMsg)ci ;
conn.RT_start() ;
}
catch(Exception e)
{
e.printStackTrace();
}
}
}

@Override
protected void connpRunInLoop() throws Exception
public void stop()
{
super.stop() ;

for(ConnPt ci:this.listConns())
{
try
{
ConnPtUDPMsg conn = (ConnPtUDPMsg)ci ;
conn.RT_stop();
}
catch(Exception e)
{
e.printStackTrace();
}
}
}



@Override
protected void connpRunInLoop() throws Exception
{
// for(ConnPt ci:this.listConns())
// {
// if(!ci.isEnable())
// continue ;
//
// ConnPtUDPMsg citc = (ConnPtUDPMsg)ci ;
// citc.RT_checkConn() ;
// }
}
}
Loading

0 comments on commit e33026c

Please sign in to comment.