What is the difference between TagData.TagID and MEMORY_BANK.TID? - motorola-emdk

I'm using the "Motorola EMDK for .NET" for a personal project and I see TagData.TagID and TagData.MemoryBankData differ (when the MEMORY_BANK.TID is selected).
The .NET documentation isn't informative, it simply states:
TagData.TagID Property
Gets the Tag ID
I dug into the "Motorola EMDK for C" API, which is the low-level interface that the .NET SDK wraps around, and it provided more details:
UNIT8* pTagID
Tag ID, for C1G2 this field refers EPC Data.
...that clears things up, except that the value for MEMORY_BANK.EPC doesn't match TagData.TagID either!
I looked at the Class 1 Gen 2 specification ( http://www.gs1.org/sites/default/files/docs/uhfc1g2/uhfc1g2_2_0_0_standard_20131101.pdf ) and none of the fields described in the tag's data structures seem to correspond to this TagID property.
I did wonder if TagData.TagID is some arbitrary, opaque value generated by the SDK as a means of uniquely identifying each tag, but I noticed that the same values are used in different sessions, so it's definitely deterministic, but what does it mean?
I wrote a program that dumps all of the memory banks of the tags and the TagID property, this is what I got:
TagData.TagID: "0000000000000000000C7D16" Bank: MEMORY_BANK_EPC , BankData: "743E30000000000000000000000C7D16"
TagData.TagID: "0000000000000000000C7D16" Bank: MEMORY_BANK_RESERVED, BankData: "0000000000000000"
TagData.TagID: "0000000000000000000C7D16" Bank: MEMORY_BANK_TID , BankData: "E20060031A8A034E"
TagData.TagID: "0000000000000000000C7D16" Bank: MEMORY_BANK_USER , BankData: "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
TagData.TagID: "3330323135385F303031" Bank: MEMORY_BANK_EPC , BankData: "EB1728003330323135385F303031"
TagData.TagID: "3330323135385F303031" Bank: MEMORY_BANK_RESERVED, BankData: "0000000000000000030004180CFA"
TagData.TagID: "3330323135385F303031" Bank: MEMORY_BANK_TID , BankData: "E2801130200029431C9701C2"
TagData.TagID: "3330323135385F303031" Bank: MEMORY_BANK_USER , BankData: "00000000"
TagData.TagID: "54573630354C5F303037" Bank: MEMORY_BANK_EPC , BankData: "B63E280054573630354C5F303037"
TagData.TagID: "54573630354C5F303037" Bank: MEMORY_BANK_RESERVED, BankData: "0000000000000000030004190CFA"
TagData.TagID: "54573630354C5F303037" Bank: MEMORY_BANK_TID , BankData: "E2801130200021A11D4501C2"
TagData.TagID: "54573630354C5F303037" Bank: MEMORY_BANK_USER , BankData: "00000000"
TagData.TagID: "54573630354C5F303132" Bank: MEMORY_BANK_EPC , BankData: "D5AA280054573630354C5F303132"
TagData.TagID: "54573630354C5F303132" Bank: MEMORY_BANK_RESERVED, BankData: "0000000000000000030004190CFA"
TagData.TagID: "54573630354C5F303132" Bank: MEMORY_BANK_TID , BankData: "E2801130200021F11D4501C2"
TagData.TagID: "54573630354C5F303132" Bank: MEMORY_BANK_USER , BankData: "00000000"
Update
It appears I didn't look closely enough!
The TagData.TagID is contained within the EPC, for example:
TagData.TagID: "3330323135385F303031" Bank: MEMORY_BANK_EPC , BankData: "EB1728003330323135385F303031"
EPC: "EB1728003330323135385F303031"
TagID: "3330323135385F303031"
According to the C1G2 specification, the beginning of the EPC is reserved as such:
0x0000 to 0x000F - StoredCRC - 0xEB17
0x0010 to 0x001F - StoredPC - 0x2800
0x0020 to 0x020F - Actual EPC value - 0x3330323135385F303031
0x0210 to 0x021F - XPC_W1 (Optional) - null
0x0220 to 0x022F - XPC_W2 (Optional) - null
That clears that up then!
But my question now is: can TagID be trusted to be globally unique like TID is? My understanding is EPC does not need to be unique, it's just an arbitrary string and is not a serial number. If this is the case, then what happens in case of an EPC collision?

There is no way to guaranty that any of these fields are unique. All of them can be updated by printer or reader. So you should trust to your RFID tags supplier or print them by your own.
EPC collision is not a problem for reader, only for your software.

Related

Autocomplete search for MongoDb and

I'm trying to build an efficient autocomplete search for my Spring boot app, but I'm not getting the proper results.
I have a cars database with multiple car models.
This is my current search aggregation
val agg = Document(
"\$search", Document(
"compound", Document(
"must", searchInput.split(" ").map {
Document(
"autocomplete", Document("query", it)
.append("path", "fullName")
)
}
)
)
)
fullName represents the full name of the car: Brand + Model + Year + Power
The search works but not good enough yet.
For instance if I search for "Ford GT" first results that come up are:
Ford Mustang GT V8 5.0
Ford Mustang GT 390 Fastback
Ford Mustang GT 302 HO
and so on.
But the first results should be:
Ford GT - 655 PS
Ford GT40 Mk III
and only afterwards, the ones above.
How can I achieve this?

Get latest record with certain criteria in linq

I have following result set. How to get latest History records which meets criteria : Status = 'A' in linq ? Grouping is done on Entity Id and Records will be sorted descending on History Id
History ID Entity ID Status
2969 6957 I
2968 6957 A
2967 6957 A
2303 6957 I
1000 6958 A
55 6959 A
50 6959 I
45 6960 I
40 6960 A
Results should give me
History ID Entity ID Status
1000 6958 A
55 6959 A
first group by entity and get the "latest" records for each group. Finally check for a status of A:
histories.GroupBy(h => h.EntityId)
.Select(g => g.OrderByDescending(h => h.HistoryID)
.First())
.Where(h => h.Status == "A");

product are not being assigned to categories via magmi

I am using magmi to upload the product it is working fine product are being uploaded.
Only one problem they are not showing up at front end but they are showing up in admin
when i try to find the reason I find that products are not being assigned to any category when i did that manually they are showing up at fronted.
Any body can help ?
Here is a sample of my CSV
sku _store _attribute_set _type _category _root_category _product_websites ada_compliant backplate_dimension base_dimension brand bulb_included bulb_type bulb_wattage canopy_dimension carton_height carton_length carton_width collection1 cost country_of_manufacture country_orgin created_at custom_design custom_design_from custom_design_to custom_layout_update depth description designer diameter dimension enable_googlecheckout energy extension finish finish1 gallery gender gift_message_available harddrive_speed hardrive has_options height height_1 image image_label in_depth lamping length manufacturer1 max_resolution media_gallery megapixels memory meta_description meta_keyword meta_title minimal_price model msrp msrp_display_actual_price_type msrp_enabled name news_from_date news_to_date no_bulbs options_container page_layout price processor ram_size required_options response_time room screensize shade_color shade_dimension shade_material shape shirt_size shoe_size shoe_type short_description small_image small_image_label special_from_date special_price special_to_date status style switch tax_class_id thumbnail thumbnail_label updated_at url_key url_path visibility weight width qty min_qty use_config_min_qty is_qty_decimal backorders use_config_backorders min_sale_qty use_config_min_sale_qty max_sale_qty use_config_max_sale_qty is_in_stock notify_stock_qty use_config_notify_stock_qty manage_stock use_config_manage_stock stock_status_changed_auto use_config_qty_increments qty_increments use_config_enable_qty_inc enable_qty_increments is_decimal_divided _links_related_sku _links_related_position _links_crosssell_sku _links_crosssell_position _links_upsell_sku _links_upsell_position _associated_sku _associated_default_qty _associated_position _tier_price_website _tier_price_customer_group _tier_price_qty _tier_price_price _group_price_website _group_price_customer_group _group_price_price _media_attribute_id _media_image _media_lable _media_position _media_is_disabled
EP777777-81 admin Default simple Wall Lights/Wall Sconces base No Maxim Lighting No Medium base bulbs 100 29.72 33.66 10.43 Basix 170 Contemporary collection with sweeping arms and clean lines. Offered in Ice glass and Satin Nickel finish or Wilshire glass and Oil Rubbed Bronze finish. Maxim Lighting 31.5 H x 32 W x L Dry Locations Satin Nickel 1 31.5 /10001CLPC.jpg Basix 9-Light Chandelier Maxim Lighting 0 Basix 9-Light Chandelier7777 Ceiling Lights, Chandeliers, lighting, lights, Maxim Lighting Maxim Lighting Basix 9-Light Chandelier $510.00 Basix 9-Light Chandelier9999 9 255 Basix 9-Light Chandelier /10001CLPC.jpg Basix 9-Light Chandelier 1 Contemporary 2 /10001CLPC.jpg Basix 9-Light Chandelier 4 26 32 10 0 1 0 0 1 1 1 100 1 1 1 0 1 0 1 0 1 0 0
I had the same problem.
BUT i used the magmi classes into an personal project, not using the magmi interface.
I solved my problem by adding in the product data array the "category_ids"=> "2" . This is the id of the category.
It may not help you, but may help others.
Looking at your CSV, some of your column names are incorrect (including Category)
For example:
_store _attribute_set _type _category _product_websites
Should be:
store attribute_set type category websites
You can see the required column names at Magmi: Import New Products
Also ensure you have the On the fly category creator/importer plugin enabled in your Magmi configuration, and that your Category column values follow the format outlined in the documentation.
Try naming the field "categories" instead of "category"

orderby Clause in linq

I have this linq syntax that I would like to order by the results based on LocalDateTime field
from d in Devices
where d.Name=="switch01"
select new {d.deviceId, Performance=d.Performance.system.io}
LocalDatetime is a property of io. I can get the results but they are not ordered by date and time.
LocalDateTime is type DateTime here is the output:
LocalDateTime Value
3/9/2012 1:05 5000.7
3/9/2012 1:15 4775.6
3/9/2012 1:35 3743.3
3/9/2012 9:05 656.3
3/9/2012 7:45 670.4
3/9/2012 10:15 621.7
3/9/2012 7:15 665.4
3/9/2012 7:10 603.9
from d in Devices
where d.Name=="switch01"
orderby d.Performance.system.io.LocalDatetime
select new {d.deviceId, Performance=d.Performance.system.io}

Method to get a summary view from a dataset

I have a dataset that looks like this:
Date
Category
Rate
Quantity
There will be 0 or 1 row for each Category for any given Date.
What is a good way to get this data into a summary type of view?
For example:
Date
Category1_Rate
Category2_Rate
Category3_Rate
Category4_Rate
I have a fixed number of Categories.
I'm using linq.
Here is an example. If I have this data:
Date Category Rate Quantity
1/1/12 toys 15 12
1/1/12 games 20 20
1/1/12 dvds 18 30
1/2/12 toys 19 13
1/2/12 dvds 20 17
I want to produce a summary that looks like this:
Date toys_rate games_rate dvds_rate
1/1/12 15 20 18
1/2/12 19 null 20
Possibly something like this
var summarydata =
from r in table
group r by r.Date into g
select new
{
Date = g.Key,
ToysRate = g.Where(e=> e.Category == "toys").Count() > 0 ?
(int?)g.Where(e=> e.Category == "toys").First().Rate : null,
GamesRate = g.Where(e=> e.Category == "games").Count() > 0 ?
(int?)g.Where(e=> e.Category == "games").First().Rate : null,
DvdsRate = g.Where(e=> e.Category == "dvds").Count() > 0 ?
(int?)g.Where(e=> e.Category == "dvds").First().Rate : null
};
Note I haven't tested this as I don't current have access to a C# environment.
EDIT - Added nullable int casts to properly set the type of the various rate fields in the resulting anonymous type.

Resources