MFP /生产打印机抄表

时间:2014-02-05 05:20:15

标签: .net wpf c#-4.0 printing printers

如何读取打印机的仪表读数?

WMI-验证它的每个属性仍然没有答案。必须是别的东西..

制造商 - 不提供解决方案,因为他们拥有不同的工具/产品。但我认为这对于程序员来说一定很容易找到它。

中的任何内容
System.Drawing.Printing? (winforms/Console)
System.Printing ? (WPF)

优选 - FujiXerox和KonicaMinolta

[UPDATE] 我已经看到了使用OLEPRNLib与打印机进行SNMP通信的示例,示例代码如下所示

 string[] ErrorMessageText = new string[8];
        ErrorMessageText[0] = "service requested";
        ErrorMessageText[1] = "offline";
        ErrorMessageText[2] = "paper jammed";
        ErrorMessageText[3] = "door open";
        ErrorMessageText[4] = "no toner";
        ErrorMessageText[5] = "toner low";
        ErrorMessageText[6] = "out of paper";
        ErrorMessageText[7] = "low paper";
        int DeviceID = 1;
        int Retries = 1;
        int TimeoutInMS = 2000;
        string CommunityString = "public";
        string IPAddressOfPrinter = "192.168.1.110";
        // Create instance of COM object
        OLEPRNLib.SNMP snmp = new OLEPRNLib.SNMP();
        // Open the SNMP connect to the printer
        snmp.Open(IPAddressOfPrinter, CommunityString, Retries, TimeoutInMS);
        // The actual Warning/Error bits
        uint WarningErrorBits = snmp.GetAsByte(String.Format("25.3.5.1.2.{0}", DeviceID));
        // The actual Status           
        uint StatusResult = snmp.GetAsByte(String.Format("25.3.2.1.5.{0}", DeviceID));
        // uint Result2 = snmp.GetAsByte(String.Format("25.3.5.1.1.{0}", DeviceID));



        string Result1Str = "";
        switch (StatusResult)
        {
            case 2: Result1Str = "OK";
                break;
            case 3: Result1Str = "Warning: ";
                break;
            case 4: Result1Str = "Being Tested: ";
                break;
            case 5: Result1Str = "Unavailable for any use: ";
                break;
            default: Result1Str = "Unknown Status Code : " + StatusResult;
                break;
        }
        string Str = "";
        if ((StatusResult == 3 || StatusResult == 5))
        {
            int Mask = 1;
            int NumMsg = 0;
            for (int i = 0; i < 8; i++)
            {
                if ((WarningErrorBits & Mask) == Mask)
                {
                    if (Str.Length > 0)
                        Str += ", ";
                    Str += ErrorMessageText[i];
                    NumMsg = NumMsg + 1;
                }
                Mask = Mask * 2;
            }
        }
        Console.WriteLine(Result1Str + Str);

上面的工作能够得到一些打印机信息,所以我希望让Meter读取正确的OID。

要找出OID,我使用了iReasoning MIB Browser ..但是无法得到我想要的东西..有什么想法吗?

0 个答案:

没有答案