GID¶
- class epc.schemes.GID(*args, **kwargs)¶
The General Identifier EPC scheme is independent of any specifications or identity scheme outside the EPC global Tag Data Standard.
General syntax: urn:epc:id:gid:ManagerNumber.ObjectClass.SerialNumber
Example: urn:epc:id:gid:95100000.12345.400
- Parameters
epc (str, optional) – Hexadecimal EPC tag data
- manager_number(manager_number)¶
Set the manager number data for the tag.
The General Manager Number identifies an organizational entity (essentially a company, manager or other organization) that is responsible for maintaining the numbers in subsequent fields – Object Class and Serial Number.
GS1 assigns the General Manager Number to an entity, and ensures that each General Manager Number is unique. Note that a General Manager Number is not a GS1 Company Prefix. A General Manager Number may only be used in GID EPCs.
- Parameters
manager_number (str, int) – GS1 manager number.
- Raises
ValueError – Unable to convert string to an integer.
AttributeError – Input outside valid range (0 to 268435455).
- Returns
The GID tag object.
- Return type
- object_class(object_class)¶
Set the object class data for the tag.
The Object Class is used by an EPC managing entity to identify a class or “type” of thing. These object class numbers, of course, must be unique within each General Manager Number domain.
- Parameters
object_class (str, int) – Numeric object class.
- Raises
ValueError – Unable to convert string to an integer.
AttributeError – Input outside valid range (0 to 16777215).
- Returns
The GID tag object.
- Return type
- serial_number(serial_number)¶
Set the serial number data for the tag.
The Serial Number code, or serial number, is unique within each object class. In other words, the managing entity is responsible for assigning unique, non-repeating serial numbers for every instance within each object class.
- Parameters
serial_number (str, int) – Numeric serial number.
- Raises
ValueError – Unable to convert string to an integer.
AttributeError – Input outside valid range (0 to 68719476735).
- Returns
The GID tag object.
- Return type
- property tag_uri¶
- Returns
The tag’s URI.
- Return type
str
- property pure_identity_uri¶
- Returns
The tag’s pure identity URI.
- Return type
str
- property values¶
- Returns
Dictionary containing:
size
(int): the tag’s size in bitsmanager_number
(int)object_class
(int)serial_number
(int)
- decode_epc(hex_string)¶
Decode an encoded tag and populate this object’s values from it.
- Parameters
hex_string (str) – Tag data encoded as a hexadecimal string.
- Raises
ValueError – EPC scheme header does not match input.
ValueError – Supplied
hex_string
bit length invalid.
- check_fields()¶
Checks to make sure all components of the tag are present, including
size
,manager_number
,object_class
andserial_number
.- Raises
AttributeError – If any components of the tag are missing.
Hint
To get the encoded tag data, use python’s built in conversion methods:
>>> tag = GID()
>>> tag.manager_number(31231).object_class(11).serial_number(12)
# Hexadecimal
>>> hex(tag)
'0x3500079ff00000b00000000c'
# Binary
>>> bin(tag)
'0b1101010000000000000111100111111111000000000000000000001011000000000000000000000000000000001100'
Constants¶
- GID.SIZE_96¶
96 bit tag size. Only size supported for this scheme.
- GID.HEADER_96¶
GS1 specified hexadecimal header for 96 bit GID tags:
0x35
.
- GID.GID_96¶
Human readable GS1 specified header for 96 bit GID tags:
gid-96
.