Esempio n. 1
0
 public static void Append(GPRS_DATA_RECORD data)
 {
     if (!IsRuning)
     {
         return;
     }
     if (DTUResolver1.TaskNumber < 4000)
     {
         DTUResolver1.Append(data);
     }
     else
     {
         if (DTUResolver2.TaskNumber < 4000)
         {
             DTUResolver2.Append(data);
         }
         else
         {
             if (DTUResolver3.TaskNumber < 4000)
             {
                 DTUResolver3.Append(data);
             }
             else
             {
                 TraceManager.AppendWarning("DTU解析队列三个消费者队列已达到上线无法插入");
             }
         }
     }
 }
Esempio n. 2
0
        private static void ReadOnce()
        {
            GPRS_DATA_RECORD dataRecord  = new GPRS_DATA_RECORD();
            bool             isNeedReply = false;
            StringBuilder    mess        = new StringBuilder(100);

            if (HDDTUAPI.do_read_proc(ref dataRecord, mess, isNeedReply) >= 0)
            {
                // 本服务以非阻塞模式运行, do_read_proc 无论有无消息都立即返回
                DTUResolverManager.Append(dataRecord);
            }
        }
Esempio n. 3
0
 public static void Append(GPRS_DATA_RECORD data)
 {
     if (!IsRuning)
     {
         return;
     }
     if (queue.IsAddingCompleted)
     {
         return;
     }
     if (queue.Count > 4096)
     {
         TraceManager.AppendErrMsg("DTU数据解析队列到达上限无法插入");
         return;
     }
     queue.Add(data);
 }
Esempio n. 4
0
        private static void Excute(GPRS_DATA_RECORD item)
        {
            switch (item.m_data_type)
            {
            case 0x01:      // 注册包
                GPRS_USER_INFO userInfo = new GPRS_USER_INFO();
                if (HDDTUAPI.get_user_info(item.m_userid, ref userInfo) == 0)
                {
                    DTUInfo sourceDTU = DTUInfo.ToDTUInfoForSoc(userInfo);
                    if (sourceDTU == null)
                    {
                        return;
                    }
                    DTUInfo targetDTU = DTUCacheManager.GetDTUInfo(item.m_userid);
                    if (targetDTU == null)
                    {
                        // 首次注册--在DBWorker从数据读取业务信息添加到缓存
                        DBWorker.Append(DBCommand.CreateDtuRegister(sourceDTU));
                    }
                    else
                    {
                        // 更新链路
                        DTUCacheManager.OperDTUCache(DTUCacheManager.OPeratingType.UpdateSocketInfo, targetDTU, sourceDTU);
                    }
                }
                break;

            case 0x02:      // 注销包
            {
                DTUCacheManager.OperDTUCache(DTUCacheManager.OPeratingType.Delete, item.m_userid, null);
            }
            break;

            case 0x04:      // 无效包
                TraceManager.AppendInfo(item.m_userid + "---接收无效的数据包");
                break;

            case 0x05:      // DTU已经接收到DSC发送的用户数据包
                TraceManager.AppendInfo(item.m_userid + "---已经接收到DSC发送的用户数据包");
                break;

            case 0x09:      // 数据包
            {
                //TraceManager.AppendInfo("DTU:" + item.m_userid + "接收了" +
                //                       ByteUtil.BytesToText(item.m_data_buf, item.m_data_len)
                //                       + "--共计" + item.m_data_len.ToString() + "个字节");

                DTUInfo dtu = DTUCacheManager.GetDTUInfo(item.m_userid);
                if (dtu == null)
                {
                    return;
                }
                dtu.Analysis(item.m_data_buf, item.m_data_len);
            }
            break;

            case 0x0d:
                TraceManager.AppendInfo(item.m_userid + "---参数设置成功");
                break;

            case 0x0b:
                TraceManager.AppendInfo(item.m_userid + "---参数查询成功");
                //  config.readconf();
                break;

            case 0x06:
                TraceManager.AppendInfo("---断开PPP连接成功");
                break;

            case 0x07:
                TraceManager.AppendInfo(item.m_userid + "---停止向DSC发送数据");
                break;

            case 0x08:
                TraceManager.AppendInfo("---允许向DSC发送数据");
                break;

            case 0x0A:
                TraceManager.AppendInfo("---丢弃用户数据");
                break;

            default:
                break;
            }
        }
Esempio n. 5
0
 public static extern int do_read_proc(
     ref GPRS_DATA_RECORD recdPtr,
     [MarshalAs(UnmanagedType.LPStr)]
     StringBuilder mess,
     bool reply);