perhaps this will help you.
you need to get the attributeSet from the printer service to findout details of the printer.
Pergunta
in a project i had discovered the UPnP printer devices by sending an ssdp datagrampacket and receiving the http url.
using these url, getting an open connection, gets the xml schema in which it describes the device and service details
here i get the details by dom parsing
now my question is, how could i find the 1. status of the printer 2. whether the printer is duplex or not 3. what kind of paper it supports (landscape/portrait and also sizes)
Solução 2
perhaps this will help you.
you need to get the attributeSet from the printer service to findout details of the printer.
Outras dicas
If you are already getting the service details, then you should be able to understand and use the following UPnP specifications: PrintBasic
service and PrintEnhanced
service (if your printer supports it). I recommend using some service discovery tool in your network, like DeviceSpy from Intel UPnP Developer Suite. You will get an idea what informations your printer provides and whether it is reachable as state variable (perhaps evented), or you need to do a RPC on service function to obtain it. Giving specific howto on what is the difference between the two, and how to obtain them, is beyond the scope of simple S.O. answer. You can start with reading and understanding the UPnP Device Architecture document. Sniffing around in DeviceSpy and trying to invoke things and see the results is also very helpful.
A quick skim of the specs (i am more into the Media services) shows that you should be good with PrintBasic
for the status (look up PrinterState
/PrinterStateReasons
) and the paper sizes (look up MediaSize
/MediaType
). I could not find duplex, it might be hiding under some other name (perhaps Sides
?). It might be perfectly possible that these i found are one-value variables for the current job. The applicable values enumerations are then probably reachable under a different name, or you need to do a RPC to obtain it. I won't be replacing your R&D here :-)
Side note: doing it all yourself by opening HTTP connection and parsing the DOM is unnecessarily tedious (unless you are doing it for pure fun). Integrate one of the mature ready-made libs like Cling. To use UPnP properly, you need a lot of complicated stuff beyond reading a simple DOM. Like listening for event subscriptions and doing SOAP RPC.