📄 onewirecontainer0f.java
字号:
* Create a container with the provided adapter instance * and the address of the iButton or 1-Wire device.<p> * * This is one of the methods to construct a container. The other is * through creating a OneWireContainer with NO parameters. * * @param sourceAdapter adapter instance used to communicate with * this 1-Wire device * @param newAddress {@link com.dalsemi.onewire.utils.Address Address} * of this 1-Wire device * * @see #OneWireContainer0F() OneWireContainer0F * @see com.dalsemi.onewire.utils.Address utils.Address */ public OneWireContainer0F (DSPortAdapter sourceAdapter, long newAddress) { super(sourceAdapter, newAddress); } /** * Create a container with the provided adapter instance * and the address of the iButton or 1-Wire device.<p> * * This is one of the methods to construct a container. The other is * through creating a OneWireContainer with NO parameters. * * @param sourceAdapter adapter instance used to communicate with * this 1-Wire device * @param newAddress {@link com.dalsemi.onewire.utils.Address Address} * of this 1-Wire device * * @see #OneWireContainer0F() OneWireContainer0F * @see com.dalsemi.onewire.utils.Address utils.Address */ public OneWireContainer0F (DSPortAdapter sourceAdapter, String newAddress) { super(sourceAdapter, newAddress); } //-------- //-------- Methods //-------- /** * Get the Dallas Semiconductor part number of the iButton * or 1-Wire Device as a string. For example 'DS1992'. * * @return iButton or 1-Wire device name */ public String getName () { return "DS1986"; } /** * Get the alternate Dallas Semiconductor part numbers or names. * A 'family' of 1-Wire Network devices may have more than one part number * depending on packaging. There can also be nicknames such as * 'Crypto iButton'. * * @return 1-Wire device alternate names */ public String getAlternateNames () { return "DS2506"; } /** * Get a short description of the function of this iButton * or 1-Wire Device type. * * @return device description */ public String getDescription () { return "65536 bit Electrically Programmable Read Only Memory " + "(EPROM) partitioned into two-hundered fifty-six 256 bit " + "pages. Each memory page can be permanently write-protected " + "to prevent tampering. Architecture allows software " + "to patch data by supersending a used page in favor of " + "a newly programmed page."; } /** * Get the maximum speed this iButton or 1-Wire device can * communicate at. * Override this method if derived iButton type can go faster then * SPEED_REGULAR(0). * * @return maximum speed * @see com.dalsemi.onewire.container.OneWireContainer#setSpeed super.setSpeed * @see com.dalsemi.onewire.adapter.DSPortAdapter#SPEED_REGULAR DSPortAdapter.SPEED_REGULAR * @see com.dalsemi.onewire.adapter.DSPortAdapter#SPEED_OVERDRIVE DSPortAdapter.SPEED_OVERDRIVE * @see com.dalsemi.onewire.adapter.DSPortAdapter#SPEED_FLEX DSPortAdapter.SPEED_FLEX */ public int getMaxSpeed () { return DSPortAdapter.SPEED_OVERDRIVE; } /** * Get an enumeration of memory bank instances that implement one or more * of the following interfaces: * {@link com.dalsemi.onewire.container.MemoryBank MemoryBank}, * {@link com.dalsemi.onewire.container.PagedMemoryBank PagedMemoryBank}, * and {@link com.dalsemi.onewire.container.OTPMemoryBank OTPMemoryBank}. * @return <CODE>Enumeration</CODE> of memory banks */ public Enumeration getMemoryBanks () { Vector bank_vector = new Vector(5); // EPROM main bank MemoryBankEPROM mn = new MemoryBankEPROM(this); mn.numberPages = 256; mn.size = 8192; bank_vector.addElement(mn); // EPROM status write protect pages bank MemoryBankEPROM wp = new MemoryBankEPROM(this); wp.bankDescription = "Write protect pages"; wp.numberPages = 4; wp.size = 32; wp.pageLength = 8; wp.generalPurposeMemory = false; wp.extraInfo = false; wp.extraInfoLength = 0; wp.extraInfoDescription = null; wp.crcAfterAddress = false; wp.READ_PAGE_WITH_CRC = MemoryBankEPROM.STATUS_READ_PAGE_COMMAND; wp.WRITE_MEMORY_COMMAND = MemoryBankEPROM.STATUS_WRITE_COMMAND; bank_vector.addElement(wp); // EPROM status write protect redirection bank MemoryBankEPROM wpr = new MemoryBankEPROM(this); wpr.bankDescription = "Write protect redirection"; wpr.numberPages = 4; wpr.size = 32; wpr.pageLength = 8; wpr.generalPurposeMemory = false; wpr.extraInfo = false; wpr.extraInfoLength = 0; wpr.extraInfoDescription = null; wpr.crcAfterAddress = false; wpr.READ_PAGE_WITH_CRC = MemoryBankEPROM.STATUS_READ_PAGE_COMMAND; wpr.WRITE_MEMORY_COMMAND = MemoryBankEPROM.STATUS_WRITE_COMMAND; wpr.startPhysicalAddress = 32; bank_vector.addElement(wpr); // EPROM status bitmap MemoryBankEPROM bm = new MemoryBankEPROM(this); bm.bankDescription = "Bitmap of used pages for file structure"; bm.numberPages = 4; bm.size = 32; bm.pageLength = 8; bm.generalPurposeMemory = false; bm.extraInfo = false; bm.extraInfoLength = 0; bm.extraInfoDescription = null; bm.crcAfterAddress = false; bm.startPhysicalAddress = 64; bm.READ_PAGE_WITH_CRC = MemoryBankEPROM.STATUS_READ_PAGE_COMMAND; bm.WRITE_MEMORY_COMMAND = MemoryBankEPROM.STATUS_WRITE_COMMAND; bank_vector.addElement(bm); // EPROM status redirection MemoryBankEPROM rd = new MemoryBankEPROM(this); rd.bankDescription = "Page redirection bytes"; rd.generalPurposeMemory = false; rd.numberPages = 32; rd.size = 256; rd.pageLength = 8; rd.extraInfo = false; rd.extraInfoLength = 0; rd.extraInfoDescription = null; rd.crcAfterAddress = false; rd.startPhysicalAddress = 256; rd.READ_PAGE_WITH_CRC = MemoryBankEPROM.STATUS_READ_PAGE_COMMAND; rd.WRITE_MEMORY_COMMAND = MemoryBankEPROM.STATUS_WRITE_COMMAND; bank_vector.addElement(rd); // setup OTP features in main memory mn.mbLock = wp; mn.mbRedirect = rd; mn.mbLockRedirect = wpr; mn.redirectPage = true; mn.lockPage = true; mn.lockRedirectPage = true; return bank_vector.elements(); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -